Upgrading to 2.18.1 (2.17.x is fine) generates a bug in my code, where i'm using createResolvers with createRemoteFileNode exactly as described here: https://github.com/gatsbyjs/gatsby/blob/master/docs/docs/schema-customization.md#feeding-remote-images-into-gatsby-image
Follow these steps: https://github.com/gatsbyjs/gatsby/blob/master/docs/docs/schema-customization.md#feeding-remote-images-into-gatsby-image
The files get downloaded and added to the schema as a File so we can query them with Sharp
This error:
ERROR
UNHANDLED REJECTION Schema must contain uniquely named types but contains multiple types named "File".
Error: Schema must contain uniquely named types but contains multiple types named "File".
- Array.reduce
- SchemaComposer.js:130 SchemaComposer.buildSchema
[carsite]/[graphql-compose]/lib/SchemaComposer.js:130:12
- schema.js:766 addCustomResolveFunctions
[carsite]/[gatsby]/dist/schema/schema.js:766:45
- schema.js:227 updateSchemaComposer
[carsite]/[gatsby]/dist/schema/schema.js:227:9
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /var/folders/pp/s13nkxgs3p55k2tysv_tbpt40000gn/T/yarn--1574329843466-0.9005054828235552/node
Yarn: 1.19.1 - /var/folders/pp/s13nkxgs3p55k2tysv_tbpt40000gn/T/yarn--1574329843466-0.9005054828235552/yarn
npm: 6.4.1 - /usr/local/bin/npm
Languages:
Python: 2.7.13 - /usr/local/bin/python
Browsers:
Chrome: 78.0.3904.108
Firefox: 63.0.3
Safari: 13.0.3
https://github.com/gatsbyjs/gatsby/pull/19092 this causes my bug. When the schema starts rebuilding, it crashes on the message written above
Does it happen in both build and develop? Could you maybe post the full log from CLI?
Just tried a build and indeed, the error does not throw on build.
It throws on develop when the first remote image is downloaded (and the schema gets updated I guess)
It is an edge case with schema rebuilding caused by third-party-schema customizations. Should be fixed by #19712 (published in gatsby 2.18.2)
Thanks for reporting this!
Thanks so much for the extremely quick fix! It's working perfectly for me <3
@vladar I get this same issue with gatsby 2.20.29 except that it鈥檚 for "ImageFormat"
@chandlervdw I suggest creating a new issue with a minimal reproduction and tag me on it.
@vladar @chandlervdw Facing same issue after adding gatsby-source-sanity-transform-images plugin.
````
Error
UNHANDLED REJECTION Schema must contain uniquely named types but contains multiple types named "ImageFormat".
Error: Schema must contain uniquely named types but contains multiple types named "ImageFormat".
Array.reduce
Array.reduce
SchemaComposer.js:130 SchemaComposer.buildSchema
[Gatsby Blog]/[graphql-compose]/lib/SchemaComposer.js:130:12
schema.js:807 addCustomResolveFunctions
[Gatsby Blog]/[gatsby]/dist/schema/schema.js:807:45
schema.js:227 updateSchemaComposer
[Gatsby Blog]/[gatsby]/dist/schema/schema.js:227:9
schema.js:95 async buildSchema
[Gatsby Blog]/[gatsby]/dist/schema/schema.js:95:3
index.js:138 async Object.build
[Gatsby Blog]/[gatsby]/dist/schema/index.js:138:18
index.js:419 async module.exports
[Gatsby Blog]/[gatsby]/dist/bootstrap/index.js:419:3
develop.js:441 async module.exports
[Gatsby Blog]/[gatsby]/dist/commands/develop.js:441:7
````
Plugins List
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`
}
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png` // This path is relative to the root of the site.
}
},
{
resolve: 'gatsby-source-sanity',
options: {
projectId: 'rhqgrccr',
dataset: 'production',
token: process.env.MY_SANITY_TOKEN
}
},
'gatsby-source-sanity-transform-images'
}
}
}
]
Most helpful comment
It is an edge case with schema rebuilding caused by third-party-schema customizations. Should be fixed by #19712 (published in
gatsby 2.18.2)Thanks for reporting this!