-
-
Notifications
You must be signed in to change notification settings - Fork 197
Closed
Description
Version: 3.10.0
Issue: Querying GSI with AWS Cross-Account Access in Dynamoid Uses Table Name Instead of Table ARN
Description
When querying a Global Secondary Index (GSI) in Dynamoid using AWS cross-account access, the library builds the query using the table name instead of the table ARN. This behavior causes issues since the correct ARN is required for cross-account access.
Example Code
class Offer
include Dynamoid::Document
table name: 'arn:aws:dynamodb:eu-west-1:123559793147:table/offers', key: :join_id, capacity_mode: :on_demand
field :shop_id, :string
field :sanitized_link, :string
global_secondary_index name: :shop_id_sanitized_link,
hash_key: :shop_id, range_key: :sanitized_link, projected_attributes: :all
end
Steps to Reproduce
This works correctly since the table ARN is used under the hood.
Offer.find('join_id')
Attempt to query a GSI. The generated query uses the table name (offers) instead of the table ARN.
Offer.where(shop_id: 'shop_id', sanitized_url: 'sanitized_url').with_index(:shop_id_sanitized_link).first
Workaround
I implemented a monkey patch to resolve the issue temporarily:
class Dynamoid::AdapterPlugin::AwsSdkV3::Table
def name
schema[:table_arn]
end
end
Metadata
Metadata
Assignees
Labels
No labels