Skip to content

Conversation

@cheruvian
Copy link

Summary

  • Fixes the "Filter Expression can only contain non-primary key attributes" error when owner or other auth fields are part of the composite primary key
  • When auth fields overlap with key condition fields, they're filtered out before adding to the filter expression

Details

When owner or other auth fields are part of the composite primary key, they're already used in the key condition expression. DynamoDB prohibits using primary key attributes in filter expressions, causing the error:
"Filter Expression can only contain non-primary key attributes"

This fix filters out any authFilter fields that overlap with the key condition fields (references) before adding them to the filter expression.

Test plan

  • Added unit tests for hasMany with owner field in composite primary key
  • Verified existing tests pass
  • Snapshot tests updated

Closes #3364

🤖 Generated with Claude Code

…r in relational resolvers

When owner or other auth fields are part of the composite primary key,
they're already used in the key condition expression. DynamoDB prohibits
using primary key attributes in filter expressions, causing the error:
"Filter Expression can only contain non-primary key attributes"

This fix filters out any authFilter fields that overlap with the key
condition fields (references) before adding them to the filter expression.

Closes aws-amplify#3364

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DynamoDB FilterExpression error on hasMany relationships when owner is in composite primary key

1 participant