amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

@searchable @model with ownerFields not returning results

Open goleksiak opened this issue 1 year ago • 1 comments

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 createInvitation mutation and successfully create an Invitation record, that record DOES get returned in a subsequent listInvitations query but does NOT get returned in a plain searchInvitations query: image
  • If I select IAM authentication and the searchInvitations query, I DO get the correct results back from OpenSearch: Screenshot 2024-01-24 at 3 20 16 PM
  • My initial thought is that Amplify doesn't support @searchable queries when an ownerField is 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

  1. Set up a model as specified above
  2. Sign into Appsync dashboard Queries page using valid a Cognito user
  3. Use Appsync dashboard Queries page to create an Invitation record
  4. Use Appsync dashboard Queries page to request the searchInvitations query with no filters etc
  5. 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.

goleksiak avatar Jan 24 '24 20:01 goleksiak

Hey, 👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂.

ykethan avatar Jan 24 '24 21:01 ykethan