Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2 stability issue] GraphQL Error Unknown field modified on type NPMPackage when running gatsby's www locally #5842

Closed
tsiq-swyx opened this issue Jun 11, 2018 · 3 comments · Fixed by #6034
Labels
help wanted Issue with a clear description that the community can help with. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@tsiq-swyx
Copy link
Contributor

tsiq-swyx commented Jun 11, 2018

Description

running the exact same code yesterday as I did today, and it's unchanged, but now I am getting this error:

npm run develop

> gatsby-starter-default@1.1.0-alpha.03b9df85 develop /Users/swyx/gatsby/StarterShowcase/gatsby/www
> gatsby develop

success delete html files from previous builds — 0.244 s
success open and validate gatsby-config — 0.004 s
success copy gatsby files — 0.034 s
success onPreBootstrap — 1.460 s
⢀ source and transform nodesThe "deleteNodes" action is now deprecated and will be removed in Gatsby v3. Please use "deleteNode" instead.
The "deleteNodes" action is now deprecated and will be removed in Gatsby v3. Please use "deleteNode" instead.
success source and transform nodes — 3.817 s
success building schema — 1.147 s
success createPages — 3.678 s
success createPagesStatefully — 0.241 s
success onPreExtractQueries — 0.008 s
success update schema — 2.190 s
warning There are conflicting field types in your data. GraphQL schema will omit those fields.
NPMPackage.created:
NPMPackage.modified:
MarkdownRemark.fields.starterShowcase.githubData.repository:
SitePluginConnection.packageJson.author:
NPMPackageConnection.created:
NPMPackageConnection.modified:
MarkdownRemarkConnection.fields.starterShowcase.githubData.repository:
GraphQL Error Unknown field `modified` on type `NPMPackage`

  file: /Users/swyx/gatsby/StarterShowcase/gatsby/www/src/templates/template-docs-local-packages.js

   9 |       }
  10 |       ...MarkdownPageFooter
  11 |     }
  12 |     npmPackage(slug: { eq: $slug }) {
  13 |       name
  14 |       keywords
  15 |       lastPublisher {
  16 |         name
  17 |         avatar
  18 |       }
> 19 |       modified
     |       ^
  20 |     }
  21 |   }
  22 |

success extract queries from components — 0.289 s
⠁ (node:73420) DeprecationWarning: Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.
success run graphql queries — 0.399 s
success write out page data — 0.023 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.001 s

info bootstrap finished - 18.178 s

ℹ 「wdm」: wait until bundle finished: /starters/test
 ERROR  Failed to compile with 2 errors                                                                                                                    09:39:57

 error  in ./src/templates/template-docs-local-packages.js

Module Error (from ./node_modules/eslint-loader/index.js):

/Users/swyx/gatsby/StarterShowcase/gatsby/www/src/templates/template-docs-local-packages.js
  96:7  error  Cannot query field "modified" on type "NPMPackage"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)


 @ ./.cache/sync-requires.js 17:77-179
 @ ./.cache/root.js
 @ ./.cache/app.js
 @ multi ./node_modules/react-hot-loader/patch.js (webpack)-hot-middleware/client.js?path=http://localhost:8000/__webpack_hmr&reload=true&overlay=false ./.cache/app

to be clear this is unrelated code to starter showcase so this could very well happen to anyone else running www on the v2 branch, potentially anyone using v2. just logging this error here for now so that others can find it, i have no idea what the cause is yet.

NOTE: when i kill the process, and simply npm run develop again, the code works and the site builds with no errors. this is very definitely a stability issue of some sort.

Steps to reproduce

git checkout v2
cd www
npm run develop

Expected result

website should run

Actual result

doesn't run

Environment

System:
OS: macOS High Sierra 10.13.3
CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 9.4.0 - /usr/local/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 6.0.1 - /usr/local/bin/npm
Browsers:
Chrome: 66.0.3359.181
Firefox: 59.0.2
Safari: 11.0.3
npmPackages:
gatsby: next => 2.0.0-alpha.51
gatsby-image: next => 2.0.0-alpha.5
gatsby-plugin-canonical-urls: next => 1.0.14-10
gatsby-plugin-catch-links: next => 2.0.1-11
gatsby-plugin-feed: next => 1.3.19-11
gatsby-plugin-fullstory: ^1.0.4-5 => 1.0.4-7
gatsby-plugin-glamor: next => 2.0.0-alpha.13
gatsby-plugin-google-analytics: next => 1.0.20-10
gatsby-plugin-lodash: next => 3.0.0-alpha.12
gatsby-plugin-mailchimp: ^2.2.3 => 2.2.3
gatsby-plugin-manifest: next => 2.0.1-17
gatsby-plugin-netlify: next => 1.0.19-11
gatsby-plugin-nprogress: next => 2.0.0-alpha.12
gatsby-plugin-offline: next => 2.0.0-alpha.15
gatsby-plugin-react-helmet: next => 2.0.12-7
gatsby-plugin-sharp: next => 2.0.0-alpha.19
gatsby-plugin-sitemap: next => 1.2.14-10
gatsby-plugin-twitter: next => 1.0.18-11
gatsby-plugin-typography: next => 2.0.1-11
gatsby-remark-autolink-headers: next => 1.4.13-11
gatsby-remark-copy-linked-files: next => 1.5.28-10
gatsby-remark-images: next => 2.0.0-alpha.21
gatsby-remark-prismjs: next => 1.2.16-11
gatsby-remark-responsive-iframe: next => 1.4.18-10
gatsby-remark-smartypants: next => 1.4.12-11
gatsby-source-filesystem: next => 2.0.0-alpha.15
gatsby-source-npm-package-search: ^1.0.8 => 1.0.8
gatsby-transformer-csv: next => 1.3.9-10
gatsby-transformer-documentationjs: next => 1.4.10-10
gatsby-transformer-remark: next => 2.0.1-13
gatsby-transformer-sharp: next => 2.0.1-13
gatsby-transformer-yaml: next => 2.0.1-11
npmGlobalPackages:
gatsby-cli: 1.1.58
gatsby: 1.9.231

File contents (if changed)

n/a

@m-allanson m-allanson added type: bug An issue or pull request relating to a bug in Gatsby help wanted Issue with a clear description that the community can help with. labels Jun 13, 2018
@m-allanson
Copy link
Contributor

Thanks @tsiq-swyx, I was able to recreate this error. Have you found a reliable way to trigger this error once you've cancelled and restarted the dev command?

@rdela
Copy link
Contributor

rdela commented Jun 18, 2018

Just ran into this working on updates to #5813

Same exact error, had not seen this issue yet and ran

rm -rf .cache/ public/ node_modules/
yarn
gatsby develop

on www, which seems was maybe overkill but it did resolve the issue.

@pieh
Copy link
Contributor

pieh commented Jun 18, 2018

More context for this error (finally happened again for me after using it with newer version of gatsby containing fix for not reporting why some fields are omitted):

warning There are conflicting field types in your data. GraphQL schema will omit those fields.
NPMPackage.created:
 - type: date
   value: 2017-12-01T14:59:45.600Z
 - type: string
   value: '2017-01-12T18:13:38.326Z'
NPMPackage.modified:
 - type: date
   value: 2018-06-18T16:13:14.686Z
 - type: string
   value: '2018-06-17T08:12:40.683Z'

This issue apply to v1 too - will happen if we already have cache and any plugin actually were updated since last run.

Need to update getExampleValue in to handle this case.

Didn't see warning/errors with these fields yet:

MarkdownRemark.fields.starterShowcase.githubData.repository:
SitePluginConnection.packageJson.author:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants