Skip to content

Change the error shown when a mutation outside of DataStore doesn't include all fields #8766

Description

@PeteDuncanson

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

DataStore

Is this related to another service?

No response

Describe the feature you'd like to request

In the discord channel we are getting this raised every week or two.

User makes a change outside of DataStore (graphql mutation directly to AppSync) but they don't include all the return fields in their query. AppSync does as requested but DataStore will ignore the mutation when its asked to sync as it doesn't have all the data it wants/needs.

This miss understanding is causing hearts to jump into mouths needlessly:

https://discordapp.com/channels/705853757799399426/831604049928257556/876826758849105940

Describe the solution you'd like

Ideally either allow DataStore to go fetch what it needs so its not skipping the sync or at least give some more information/warning on what is actually happening when this error occurs and why rather than the existing error which is far from descriptive. A link to some docs or something for more information, or flag it up as a warning in the console with a suggestion as to why...

Instead of:
"DataStore - Skipping incoming subscription. Messages: Cannot return null for non-nullable type"

Try:
"DataStore - Skipping incoming subscription. Seems we don't have all the fields return that we need, are you updating a model outside of DataStore? If so make sure you mutation returns all the fields as part of its query. Learn more."

Describe alternatives you've considered

Other that continuing to hang out in the Discord channel answering this every other week I don't know what else we can do. The error is too terse and gives you nothing to go on to try to fix it, the problem lies there.

The alternative "solution" would be to make the error go away completely, if the subscription doesn't have the data it needs then go fetch it and raise a warning so that the developers are aware that this should be fixed if they want to optimise DataStore and save some hits to the endpoint.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions