Skip to content

Android's mutation selection set is incompatible with iOS' subscription handling #1772

@eeatonaws

Description

@eeatonaws

Before opening, please confirm:

Language and Async Model

Not applicable

Amplify Categories

DataStore

Gradle script dependencies

N/A

Environment information

N/A

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

From @Amplifiyer:

While testing the sync between local and remote, there is some weird behavior between how it works in iOS and Android. The selection set of the create mutations in iOS seem to include the full nested model fields, while in android it’s only the ID. So for instance if I create two mutations from AppSync as follows:

mutation OnlyIdMutation {
  createPost(input: {blogID: "6a83a3b4-2b82-4dfa-8b58-5e32326865a2", rating: 10, title: "Remote blog 6"}) {
    _deleted
    _lastChangedAt
    _version
    blogID
    created
    createdAt
    id
    rating
    title
    updatedAt
    blog {
      id
    }
  }
}

and

mutation FullNestedModelMutation {
  createPost(input: {blogID: "6a83a3b4-2b82-4dfa-8b58-5e32326865a2", rating: 10, title: "Remote blog 6"}) {
    _deleted
    _lastChangedAt
    _version
    blogID
    created
    createdAt
    id
    rating
    title
    updatedAt
    blog {
      id
      updatedAt
      name
      createdAt
      _version
      _lastChangedAt
      _deleted
    }
  }
}

Both are successful on Android, but only the later works on iOS. The first one will result in some GraphQL errors on the iOS client:

{
  "id": "2ACF986E-7607-4CD7-AEE3-148F34B01183",
  "type": "data",
  "payload": {
    "data": {
      "onCreatePost": {
        "id": "909fccc6-7ad3-4408-8b49-23616123413e",
        "created": null,
        "rating": 3,
        "title": "Post 2 android\t",
        "blog": null,
        "__typename": "Post",
        "_version": 1,
        "_deleted": null,
        "_lastChangedAt": 1606251462643
      }
    },
    "errors": [
      {
        "message": "Cannot return null for non-nullable type: 'String' within parent 'Blog' (/onCreatePost/blog/name)",
        "path": [
          "onCreatePost",
          "blog",
          "name"
        ]
      },
      {
        "message": "Cannot return null for non-nullable type: 'Int' within parent 'Blog' (/onCreatePost/blog/_version)",
        "path": [
          "onCreatePost",
          "blog",
          "_version"
        ]
      },
      {
        "message": "Cannot return null for non-nullable type: 'AWSTimestamp' within parent 'Blog' (/onCreatePost/blog/_lastChangedAt)",
        "path": [
          "onCreatePost",
          "blog",
          "_lastChangedAt"
        ]
      }
    ]
  }
}

Reproduction steps (if applicable)

No response

Code Snippet

No response

Log output

No response

amplifyconfiguration.json

No response

GraphQL Schema

No response

Additional information and screenshots

A few notes on the issue:

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingclosing soonThis issue will be closed in 7 days unless further comments are made.datastoreDataStore category/pluginsflutterCalling Amplify Android via the Flutter facade

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions