jlengstorf / netlify-plugin-gatsby-cache

185 stars 21 forks source link

GraphQL queries to service fail after installing plugin #48

Open richardfrankza opened 3 years ago

richardfrankza commented 3 years ago

Hi there

I use https://formium.io/

When I clear cache the build works, but when the cache is loaded it fails.

7:50:16 AM: success createPagesStatefully - 0.109s 7:50:16 AM: success Cleaning up stale page-data - 0.002s 7:50:16 AM: success update schema - 0.044s 7:50:16 AM: success onPreExtractQueries - 0.004s 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Unknown argument "slug" on field "formiumForm" of type "Query". 7:50:21 AM: GraphQL request:3:17 7:50:21 AM: 2 | { 7:50:21 AM: 3 | formiumForm(slug: { eq: "example" }) { 7:50:21 AM: | ^ 7:50:21 AM: 4 | id 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Cannot query field "createAt" on type "FormiumForm". 7:50:21 AM: If you don't expect "createAt" to exist on the type "FormiumForm" it is most likely a typo. However, if you expect "createAt" to exist there are a couple of solutions to common problems: 7:50:21 AM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server 7:50:21 AM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have 7:50:21 AM: - You want to optionally use your field "createAt" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content") 7:50:21 AM: It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "FormiumForm": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Cannot query field "name" on type "FormiumForm". 7:50:21 AM: If you don't expect "name" to exist on the type "FormiumForm" it is most likely a typo. However, if you expect "name" to exist there are a couple of solutions to common problems: 7:50:21 AM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server 7:50:21 AM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have 7:50:21 AM: - You want to optionally use your field "name" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content") 7:50:21 AM: It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "FormiumForm": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Cannot query field "projectId" on type "FormiumForm". 7:50:21 AM: If you don't expect "projectId" to exist on the type "FormiumForm" it is most likely a typo. However, if you expect "projectId" to exist there are a couple of solutions to common problems: 7:50:21 AM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server 7:50:21 AM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have 7:50:21 AM: - You want to optionally use your field "projectId" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content") 7:50:21 AM: It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "FormiumForm": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Cannot query field "slug" on type "FormiumForm". 7:50:21 AM: If you don't expect "slug" to exist on the type "FormiumForm" it is most likely a typo. However, if you expect "slug" to exist there are a couple of solutions to common problems: 7:50:21 AM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server 7:50:21 AM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have 7:50:21 AM: - You want to optionally use your field "slug" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content") 7:50:21 AM: It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "FormiumForm": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Cannot query field "updateAt" on type "FormiumForm". 7:50:21 AM: If you don't expect "updateAt" to exist on the type "FormiumForm" it is most likely a typo. However, if you expect "updateAt" to exist there are a couple of solutions to common problems: 7:50:21 AM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server 7:50:21 AM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have 7:50:21 AM: - You want to optionally use your field "updateAt" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content") 7:50:21 AM: It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "FormiumForm": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions 7:50:21 AM: error There was an error in your GraphQL query: 7:50:21 AM: Cannot query field "version" on type "FormiumForm". 7:50:21 AM: If you don't expect "version" to exist on the type "FormiumForm" it is most likely a typo. However, if you expect "version" to exist there are a couple of solutions to common problems: 7:50:21 AM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server 7:50:21 AM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have 7:50:21 AM: - You want to optionally use your field "version" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content") 7:50:21 AM: It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "FormiumForm": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions 7:50:21 AM: failed extract queries from components - 4.900s 7:50:21 AM: npm ERR! code ELIFECYCLE 7:50:21 AM: npm ERR! errno 1 7:50:21 AM: npm ERR! gatsby-starter-default@0.1.0 build: cross-env NODE_OPTIONS="-r esm" GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages 7:50:21 AM: npm ERR! Exit status 1 7:50:21 AM: npm ERR! 7:50:21 AM: npm ERR! Failed at the gatsby-starter-default@0.1.0 build script. 7:50:21 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 7:50:21 AM: npm ERR! A complete log of this run can be found in: 7:50:21 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-01-20T05_50_21_560Z-debug.log 7:50:21 AM: ​ 7:50:21 AM: ──────────────────────────────────────────────────────────────── 7:50:21 AM: "build.command" failed
7:50:21 AM: ──────────────────────────────────────────────────────────────── 7:50:21 AM: ​ 7:50:21 AM: Error message 7:50:21 AM: Command failed with exit code 1: npm run build 7:50:21 AM: ​ 7:50:21 AM: Error location 7:50:21 AM: In Build command from Netlify app: 7:50:21 AM: npm run build 7:50:21 AM: ​ 7:50:21 AM: Resolved config 7:50:21 AM: build: 7:50:21 AM: base: /opt/build/repo/frontend 7:50:21 AM: command: npm run build 7:50:21 AM: commandOrigin: ui 7:50:21 AM: environment: 7:50:21 AM: - FORMIUM_TOKEN 7:50:21 AM: - GATSBY_FORMIUM_PROJECTID 7:50:21 AM: - SANITY_TOKEN 7:50:21 AM: functions: /opt/build/repo/frontend/functions 7:50:21 AM: publish: /opt/build/repo/frontend/public 7:50:21 AM: plugins: 7:50:21 AM: - inputs: {} 7:50:21 AM: origin: ui 7:50:21 AM: package: netlify-plugin-gatsby-cache 7:50:21 AM: Caching artifacts 7:50:21 AM: Started saving node modules 7:50:21 AM: Finished saving node modules 7:50:21 AM: Started saving build plugins 7:50:21 AM: Finished saving build plugins 7:50:21 AM: Started saving pip cache 7:50:21 AM: Finished saving pip cache 7:50:21 AM: Started saving emacs cask dependencies 7:50:21 AM: Finished saving emacs cask dependencies 7:50:21 AM: Started saving maven dependencies 7:50:21 AM: Finished saving maven dependencies 7:50:21 AM: Started saving boot dependencies 7:50:21 AM: Finished saving boot dependencies 7:50:21 AM: Started saving rust rustup cache 7:50:21 AM: Finished saving rust rustup cache 7:50:21 AM: Started saving go dependencies 7:50:21 AM: Finished saving go dependencies 7:50:21 AM: Build failed due to a user error: Build script returned non-zero exit code: 2 7:50:21 AM: Failing build: Failed to build site 7:50:21 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 7:50:22 AM: Finished processing build request in 1m4.958713578s

jlengstorf commented 3 years ago

hey there!

if you run your build locally without deleting the cache or public folders, do you get this same error? this plugin has no effect on how Gatsby operates, so my suspicion is that either this failure occurs when Formium finds a cache (triggering it to skip something) or that a folder not in the .cache or public directory is created that doesn't get cached by this plugin

it's hard to say without seeing a reproduction, though, so if you're unable to reproduce this in local builds, a reproduction so I can check the output would be super helpful

thank you!

richardfrankza commented 3 years ago

I don't delete anything locally. Formium builds perfectly locally. When I get time I will produce a minimalist repo you can use as a test.