njosefbeck / gatsby-source-stripe

Gatsby source plugin for building websites using Stripe as a data source
74 stars 17 forks source link

Using gatsby-transformer-json in the same project causes build errors #40

Closed outlandnish closed 5 years ago

outlandnish commented 5 years ago

Pre-requisites

Description

When running gatsby build on a project that uses both gatsby-source-stripe and gatsby-transformer-json, the build fails with an error like the following:

Error: Nodes can only be updated by their owner. Node "prod_FKQdtEsTJLpdoG" is owned by "gatsby-source-stripe" and another plugin "gatsby-transformer-json" tried to update it.

With a non-zero exit code, the build fails.

Steps to Reproduce

  1. Create a new Gatsby project that uses gatsby-source-stripe
  2. Add your stripe credentials via environment variable or .env file
  3. Add gatsby-transformer-json to plugins section of gatsby-config.js
  4. Run gatsby build

Expected behavior: gatsby-transformer-node does nothing to the Stripe object nodes

Actual behavior: gatsby-transformer-node sees an application/json node internal type and tries to transform it.

Reproduces how often: 100% of builds

Versions

os: [version] node: 10.13.0 npm: 6.7.0 gatsby: 2.10.4 gatsby-source-stripe: 3.0.1

Additional Information

If you modify the plugin to use a different internal mediaType in StripeObject.js, the error disappears.

njosefbeck commented 5 years ago

Apologies for the delayed response! This mediaType gets added at this line for anyone that might want to fix this before I can get to it. Otherwise I'll work on having this fixed by the end of this week.

Thanks for bringing this to our attention :+1:!

njosefbeck commented 5 years ago

@nsamala Sorry for the delay with this! New version 3.0.2 should be up on npm, if you wouldn't mind testing.

Once you've confirmed it works on your end, I'll close this issue. Thanks!

njosefbeck commented 5 years ago

No response from OP, going to close this for now. Please re-open if this is still an issue! Thanks.