Skip to content

Amplify Datatstore - change in graphql shema raised error "Failure performing sync query to AppSync" #496

@rajesh-kc

Description

@rajesh-kc

Describe the bug
New posts not saving to aws amplify datastore, instead storing posts locally at app level. Graphql Schema changes to API are successfully pushed to server, but "type mismatch error" is raised

ERROR:

Initial cloud sync failed.
DataStoreException{message=Failure performing sync query to AppSync: [GraphQLResponse.Error{message='Can't resolve value (/syncArticles/items[0]/file) : type mismatch error, expected type LIST', locations='null', path='[GraphQLPathSegment{value='syncArticles'}, GraphQLPathSegment{value='items'}, GraphQLPathSegment{value='0'}, GraphQLPathSegment{value='file'}]', extensions='null'}], cause=null, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}
Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY
Setting currentState to LOCAL_ONLY

On Graphql schema, a field datatype is changed from String to List([String]). Amplify model is generated. API Change is pushed to aws amplify. On amplify backend UI, code is deployed and saved.

To Reproduce
Steps to reproduce the behavior:

  1. In a existing flutter app using amplify_datastore package, change graphql schema of a field/column from String to List
  2. Run commands "amplify codegen models" & "amplify push" to push changes to aws amplify
  3. In aws, amplify service - Deploy schema on Backend UI
  4. When the application is run, error is raised - "Initial cloud sync failed."
  5. Now user is properly authenticated with cognito, When a new post is saved, files are being uploaded to s3, but post content is not stored to Datastore - instead saving locally at application level

Expected behavior
New post should be saved to amplify datastore service or failed, but not to local storage at app level

Screenshots
Screenshots are added

Platform
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
[] Android only

Output of flutter doctor -v
  • Flutter version 2.0.3 at /home/rajesh/snap/flutter/common/flutter
  • Framework revision 4d7946a68d (2 weeks ago), 2021-03-18 17:24:33 -0700
  • Engine revision 3459eb2436
  • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
  • Android SDK at /home/rajesh/Android/Sdk
  • Platform android-30, build-tools 30.0.3
  • ANDROID_HOME = /home/rajesh/Android/Sdk
  • Java binary at: /snap/android-studio/current/android-studio/jre/bin/java
  • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
  • All Android licenses accepted.

[✓] Chrome - develop for the web
  • Chrome at google-chrome

[✓] Android Studio
  • Android Studio at /snap/android-studio/current/android-studio
  • Flutter plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/9212-flutter
  • Dart plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/6351-dart
  • android-studio-dir = /snap/android-studio/current/android-studio
  • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Community Edition (version 2020.3)
  • IntelliJ at /snap/intellij-idea-community/273
  • Flutter plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/9212-flutter
  • Dart plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
  • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
  • Chrome (web)                • chrome        • web-javascript • Google Chrome 89.0.4389.114

• No issues found!

Smartphone (please complete the following information):

  • Device: Android studio emulator
  • OS: Ubuntu 20.04
  • Version API 30

Additional context
Why is new post being saved to LOCAL when API sync fails, instead of failing. There were no configuration settings to modify this behaviour
Screenshot from 2021-04-03 19-00-31
Screenshot from 2021-04-03 19-00-18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions