question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby develop fails - reserved field name in the context object

See original GitHub issue

Hi, trying to use this plugin but receive the following error. Seems to be a conflict with Graphql. Any ideas for a workaround/override? Any suggestions gratefully received!

 ERROR #11324 

The plugin "gatsby-plugin-react-i18next" used a reserved field name in the context object when creating a page:

  * "path"

{
   ...myObject...
}

Data in "context" is passed to GraphQL as potential arguments when running the
page query.

When arguments for GraphQL are constructed, the context object is combined with
the page object so *both* page object and context data are available as
arguments. So you don't need to add the page "path" to the context as it's
already available in GraphQL. If a context field duplicates a field already
used by the page object, this can break functionality within Gatsby so must be
avoided.

Please choose another name for the conflicting fields.

The following fields are used by the page object and should be avoided.

  * "path"
  * "matchPath"
  * "component"
  * "componentChunkName"
  * "pluginCreator___NODE"
  * "pluginCreatorId"



See the documentation for the "createPage" action — https://www.gatsbyjs.org/docs/actions/#createPage

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
cn2amzcommented, Aug 7, 2022

The compilation was ok before, and the problem has been reproduced since today. It may be caused by the latest version upgrade. error message as below:

ERROR #11324

The plugin “gatsby-plugin-react-i18next” used a reserved field name in the context object when creating a page:

  • “path”

{ “path”: “/404.html”, “component”: “//src/pages/404.js”, “context”: { “path”: “/404”, “language”: “en”, “i18n”: { “language”: “en”, “languages”: [ “en” ], “defaultLanguage”: “en”, “generateDefaultLanguagePage”: false, “routed”: false, “originalPath”: “/404”, “path”: “/404” } }, “status”: “404” }

Data in “context” is passed to GraphQL as potential arguments when running the page query.

When arguments for GraphQL are constructed, the context object is combined with the page object so both page object and context data are available as arguments. So you don’t need to add the page “path” to the context as it’s already available in GraphQL. If a context field duplicates a field already used by the page object, this can break functionality within Gatsby so must be avoided.

Please choose another name for the conflicting fields.

The following fields are used by the page object and should be avoided.

  • “path”
  • “matchPath”
  • “component”
  • “componentChunkName”
  • “pluginCreator___NODE”
  • “pluginCreatorId”

See the documentation for the “createPage” action — https://www.gatsbyjs.com/docs/reference/config-files/actions#createPage

not finished createPagesStatefully - 0.465s

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed. Exit code: 1 Command: C:\Users\charlie\AppData\Local\nvs\node\18.2.0\x64\node.exe

0reactions
jimmyncommented, Aug 9, 2022

It is fixed in 2.0.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Common Errors - Gatsby
If the error is describing an Unknown field 'X' on type 'Query' , the content type you are trying to source is likely...
Read more >
Knex Query Builder
The heart of the library, the knex query builder is the interface used for building and executing standard SQL queries, such as select...
Read more >
SyntaxError: function statement requires a name - JavaScript
The JavaScript exception "function statement requires a name" occurs when there is a function statement in the code that requires a name.
Read more >
The Great Gatsby - Thomas Deacon Academy
At one point, Nick's neighbor “Gatsby” is mentioned and Daisy catches the name in surprise. Dinner is tense; Jordan reveals that it is...
Read more >
better quality framework Entirely subjective. Better in what ways? I'd ...
I'd argue Gatsby and Next have different strengths, which is exactly what I said ... isn't absolute ✓ Fails if use a reserved...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found