amplify-swift
                                
                                 amplify-swift copied to clipboard
                                
                                    amplify-swift copied to clipboard
                            
                            
                            
                        DataStore cannot receive mutation updates made from Android, Amplify Studio
Describe the bug
In an App created using amplify-ios, or amplify-flutter (iOS platform), DataStore cannot receive mutation updates made from Android, Amplify Studio content management interface that are running with the same backend.
Related issues:
https://github.com/aws-amplify/amplify-flutter/issues/663 https://github.com/aws-amplify/amplify-android/issues/995
Condition: when model relationship is involved, and selection set is incompatible cross amplify libraries.
In iOS device, DataStore subscription receives event but the event actually is an error, e.g.
// Create a Post in Amplify Studio
// Subscription error occurred in amplify-ios backed App
{
  "id": "2FD9A5DC-0721-4F08-AFA5-A63099436BDB",
  "type": "data",
  "payload": {
    "data": {
      "onCreatePost": {
        "id": "d8ae7b09-b0b8-4a86-8095-42db434eae88",
        "createdAt": "2022-02-23T18:31:55.785Z",
        "rating": 10,
        "title": "Post from Studio",
        "updatedAt": "2022-02-23T18:31:55.785Z",
        "blog": null,
        "__typename": "Post",
        "_version": 1,
        "_deleted": null,
        "_lastChangedAt": 1645641115815
      }
    },
    "errors": [
      {
        "message": "Cannot return null for non-nullable type: 'AWSDateTime' within parent 'Blog' (/onCreatePost/blog/createdAt)",
        "path": ["onCreatePost", "blog", "createdAt"]
      },
      {
        "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: 'AWSDateTime' within parent 'Blog' (/onCreatePost/blog/updatedAt)",
        "path": ["onCreatePost", "blog", "updatedAt"]
      },
      {
        "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"]
      }
    ]
  }
}
// Create a Post in amplify-android backed App
// Subscription error occurred in amplify-ios backed App
{
  "id": "2FD9A5DC-0721-4F08-AFA5-A63099436BDB",
  "type": "data",
  "payload": {
    "data": {
      "onCreatePost": {
        "id": "114d4f13-972b-4bfc-ae30-4eb614a8c7df",
        "createdAt": "2022-02-23T18:47:45.421Z",
        "rating": 10,
        "title": "Test Post",
        "updatedAt": "2022-02-23T18:47:45.421Z",
        "blog": null,
        "__typename": "Post",
        "_version": 1,
        "_deleted": null,
        "_lastChangedAt": 1645642065440
      }
    },
    "errors": [
      {
        "message": "Cannot return null for non-nullable type: 'AWSDateTime' within parent 'Blog' (/onCreatePost/blog/createdAt)",
        "path": ["onCreatePost", "blog", "createdAt"]
      },
      {
        "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: 'AWSDateTime' within parent 'Blog' (/onCreatePost/blog/updatedAt)",
        "path": ["onCreatePost", "blog", "updatedAt"]
      },
      {
        "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"]
      }
    ]
  }
}
Steps To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Expected behavior
Mutation updates should work cross amplify libraries.
Amplify Framework Version
1.22.0
Amplify Categories
DataStore
Dependency manager
Swift PM
Swift version
5
CLI version
The latest
Xcode version
13.2.1
Relevant log output
No response
Is this a regression?
No
Regression additional context
No response
Device
iPhone 13 simulators
iOS Version
iOS 15
Specific to simulators
No response
Additional context
No response