datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 50 forks source link

Building-Schema (Breaks build) #201

Closed joebentaylor1995 closed 1 year ago

joebentaylor1995 commented 1 year ago

After installing a new Gatsby site everything was working fine in development and build, however the second i instaleld this plugin, I can no longer build the site.

Heres my error output:

 ERROR 

Missing onError handler for invocation 'building-schema', error was 'Error: Type with name "DatoCmsMetaFieldFilter" does not exists'. Stacktrace was 'Error: Type with name "DatoCmsMetaFieldFilter" does not exists
    at Error.<anonymous> (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/core-js/internals/wrap-error-constructor-with-cause.js:37:62)
    at new Error (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/core-js/modules/es.error.cause.js:28:43)
    at SchemaComposer.get (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/graphql-compose/src/TypeStorage.ts:39:13)
    at SchemaComposer.getAnyTC (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/graphql-compose/src/SchemaComposer.ts:786:19)
    at forEach (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/sort.ts:94:45)
    at Array.forEach (<anonymous>)
    at convert (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/sort.ts:67:23)
    at forEach (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/sort.ts:99:11)
    at Array.forEach (<anonymous>)
    at convert (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/sort.ts:67:23)
    at getFieldsEnum (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/sort.ts:137:18)
    at createPagination (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/pagination.ts:92:24)
    at getPagination (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/types/pagination.ts:76:10)
    at addTypeToRootQuery (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/schema.js:1246:24)
    at processTypeComposer (/Users/joebentaylor/Documents/www.nosync/sirio-strategies/node_modules/gatsby/src/schema/schema.js:226:13)
    at async Promise.all (index 74)'

⠇ building schema

Heres my packages

{
    "dependencies": {
        "babel-plugin-styled-components": "2.0.7",
        "gatsby": "4.24.3",
        "gatsby-plugin-alias-imports": "1.0.5",
        "gatsby-plugin-breakpoints": "1.3.7",
        "gatsby-plugin-image": "2.24.0",
        "gatsby-plugin-layout": "3.24.0",
        "gatsby-plugin-manifest": "4.24.0",
        "gatsby-plugin-netlify": "5.0.1",
        "gatsby-plugin-react-helmet": "5.24.0",
        "gatsby-plugin-sharp": "4.24.0",
        "gatsby-plugin-styled-components": "5.24.0",
        "gatsby-plugin-transitions": "2.1.7",
        "gatsby-source-datocms": "^4.0.3",
        "gatsby-transformer-sharp": "4.24.0",
        "gsap": "3.11.3",
        "prop-types": "^15.8.1",
        "react": "18.2.0",
        "react-dom": "18.2.0",
        "react-helmet": "6.1.0",
        "react-spring": "^9.5.5",
        "react-use": "17.4.0",
        "styled-components": "5.3.6"
    },
}

Im at a bit of a loss, ive never encountered this issue before and even trying the pre-release 5.0.0-2 doesnt fix this either

stefanoverna commented 1 year ago

What's the ID of your DatoCMS project? We can try to reproduce the issue!

joernroeder commented 1 year ago

I have the same issue,, created a fresh gatsby 5 project and copied over the (gatsby-)configuration of the dato instance. The config has the instancePrefix set and removing it fixes the issue. I think this is related to what I reported a while back #172

stefanoverna commented 1 year ago

v5.0.2 should solve this!