Skip to content

DataStore initial sync slower after recreating auth and schema has owner-based permissions #4943

@erickotsuka

Description

@erickotsuka

Description

In a project I am working on, I had to update the sign in method from email and password to phone number and password. The project was also using a GraphQL API with DataStore for offline capabilities, and the schemas had owner-based permissions. To do that, I had to first remove the auth category and recreate it using phone number sign in. When I updated the environment, the initial DataStore sync was a lot slower. However, when I created a new environment based on the updated environment, the initial sync was normal in the new environment.

Categories

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

Steps to Reproduce

I've created a small Flutter app to reproduce this problem, it is here: https://github.com/erickotsuka/slow_sync_demo.

In this repository, there are 3 branches: master, phone-number-login and new-env.

  • The master branch is the "original" project, using email sign in and owner-based permissions. The README on this branch contains the steps used to setup. I also included the amount of time it took for the initial query to complete 3 times (clearing the app's storage on Android Emulator before each time).
  • The phone-number-login branch is the project after updating to use phone number sign in. The README on this branch contains the master branch's content plus the steps used to update to phone number sign in. And, again, the amount of time for the initial query to complete 3 times, using the same strategy.
  • The new-env branch is the project after creating a new environment based on the changes in phone-number-login branch. The README follows the same pattern.

In conclusion, originally the initial query took an average of 2273 ms. After updating the same environment to use phone number sign in, the initial query took and average of 12722 ms. On the new environment created based on the updated environment, the initial query took an average of 2971 ms.

The version of the amplify CLI used was 12.10.3.

Screenshots

No response

Platforms

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

Flutter Version

3.22.0

Amplify Flutter Version

1.8.0

Deployment Method

Amplify CLI

Schema

type User 
  @model
  @auth(
    rules: [
      { allow: owner }
      { allow: public, provider: apiKey }
    ]
  ) {
  id: ID!
  name: String!
  owner: String @auth(
    rules: [
      { allow: owner, operations: [read] }
      { allow: public, provider: apiKey, operations: [create, read, update, delete] }
    ]
  )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    AndroidIssues specific to the Android PlatformbugSomething is not working; the issue has reproducible steps and has been reproduceddatastoreIssues related to the DataStore Category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions