amplify-category-api
amplify-category-api copied to clipboard
@searchable @model with ownerFields not returning results
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.13.0
Amplify CLI Version
12.10.1
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
The following model returns 0 results when using the Amplify codegen'd searchInvitations query:
type Invitation @model @searchable @auth( rules: [ { allow: owner, ownerField: "owners", operations: [create, read, update] } { allow: private, provider: iam } ] ) { id: ID! acceptedAt: AWSDateTime sentAt: AWSDateTime accepted: Boolean! owners: [String] phone: String! @index name: String! account: Account @belongsTo enabled: Boolean! }
- Given I am signed into Appsync dashboard Queries page using valid a Cognito user:
- If I use the Appsync dashboard query to
listInvitations, and run the query, it returns ALL the expected results correctly. - If I change the Appsync dashboard query to the
createInvitationmutation and successfully create an Invitation record, that record DOES get returned in a subsequentlistInvitationsquery but does NOT get returned in a plainsearchInvitationsquery: - If I select IAM authentication and the
searchInvitationsquery, I DO get the correct results back from OpenSearch: - My initial thought is that Amplify doesn't support @searchable queries when an
ownerFieldis set but I can't find any record of that limitation so I have to assume this is a bug
Expected behavior
Query should return results
Reproduction steps
- Set up a model as specified above
- Sign into Appsync dashboard Queries page using valid a Cognito user
- Use Appsync dashboard Queries page to create an Invitation record
- Use Appsync dashboard Queries page to request the
searchInvitationsquery with no filters etc - See that no results are returned
Project Identifier
c2555a49226218d18b8bdb8587ec610f
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Hey, 👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂.