Skip to content

Critical: DataStore GraphQL owner sub stored in wrong, duplicated format (sub::sub instead of sub) #5792

Open
@NiklasMeetyu

Description

@NiklasMeetyu

Description

Dear Team,

currently our app launch is delayed because of this issue. We're using the AWS Amplify Gen 1 DataStore (android/iOS) in Flutter with Cognito Auth and store the sub (i.e. userid) automatically alongside our data. The graph ql schema does that for us automatically. See here:

type UserSettings
@model
@auth(
rules: [
{
allow: owner
ownerField: "ownerID"
operations: [create, update, delete, read]
},
{ allow: public, provider: apiKey, operations: [update, read] }
]
) {
id: ID!
name: String
language: String
ownerID: ID @index(name: "byOwnerID", queryField: "getUserSettingsByOwnerID")
}

In the AWS console we can see the data in DynamoDB where it is finally loaded automatically for us as part of the Amplify DataStore logic.

Issue:
We noticed, that in most "rows" in these Dynamo DB tables, the sub is stored wrongly like this:
sub::sub (e.g. hgusas-181273-...-1212::hgusas-181273-...-1212)
However, we would expect (which only in some case works)
sub (e.g. hgusas-181273-...-1212)

The mix up of two different formats leads to issues on our end. Can you please help us understand why the format is inconsistent? Adjusting our functions to identify duplicated data seems like a "dirty" solution that doesn't address the real problem. What do you think?

Kind regards,
Niklas

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Add GraphQL like we did with Cognito based Auth tags
  2. Create the type from Step 1 (for different users and experiment for some what happens when you change it for the same user)
  3. Observe the data in DynamoDB and observe the "ownerID" field. You should see that the format is often sub::sub and only sometimes the correct, expected sub.

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.27.0

Amplify Flutter Version

^2.3.0

Deployment Method

Amplify CLI (Gen 1)

Schema

type UserSettings
  @model
  @auth(
    rules: [
      {
        allow: owner
        ownerField: "ownerID"
        operations: [create, update, delete, read]
      },
      { allow: public, provider: apiKey, operations: [update, read] }
    ]
  ) {
  id: ID!
  name: String
  language: String
  ownerID: ID @index(name: "byOwnerID", queryField: "getUserSettingsByOwnerID")
}

Metadata

Metadata

Assignees

Labels

questionA question about the Amplify Flutter librariesto-be-reproducedIssues that have not been reproduced yet, but have reproduction steps provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions