allows users to provide a hook when graphql protected customer data e… #672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Gadget has just completed migrating all of our Shopify syncing engine to using the GraphQL api exclusively. One pain point in doing so was dealing with models that have protected customer data fields. Because there is no way to know if an app has filled out the form to request specific customer data fields the only way to know if Gadget can query these fields on apps behalf is to try.
Unfortunately with the way that shopify-api-node is currently set up, if an app does not have access the query will throw since shopify populates the
errors
field. However they also will return the data for the query, but withnull
in the place of the protected fields.I think the default behaviour of throwing if the
errors
field is populated makes sense, however in this case we would like the option to not throw.To resolve this I have added a configuration to the client
onProtectedCustomerDataError
that allows for custom handling of this situation.Let me know what you think
cc @lpinca @airhorns @jcao49