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.

Error with gatsby-plugin-styled-components and Gatsby v2.24.67: pluginOptionsSchema not available

See original GitHub issue

Description

Apologies if I’m missing something obvious here. While running gatsby build I see the following error message in gatsby-plugin-styled-components:

ERROR #11329 

Your plugins must export known APIs from their gatsby-node.js.

See https://www.gatsbyjs.org/docs/node-apis/ for the list of Gatsby node APIs.

- The plugin gatsby-plugin-styled-components@3.3.14 is using the API "pluginOptionsSchema" which is not available in your version of Gatsby.

Not sure if I should be using a different version of Gatsby? I found this - again, not sure how relevant it is here?

Steps to reproduce

I’ve created a minimal reproduction of the issue here. It’s just a hello world starter with gatsby-plugin-styled-components plugin installed. Steps to reproduce:

  1. Clone https://github.com/daiviknema/styled-components-issue
  2. Run npm install
  3. Run gatsby build. The error should pop up after the “open and validate gatsby-configs” step

Environment

Output of gatsby info --clipboard:

  System:
    OS: Linux 4.15 Ubuntu 18.04.5 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 14.12.0 - /usr/bin/node
    npm: 6.14.8 - /usr/bin/npm
  Languages:
    Python: 2.7.17 - /usr/bin/python
  Browsers:
    Firefox: 81.0
  npmPackages:
    gatsby: ^2.24.67 => 2.24.67
    gatsby-plugin-styled-components: ^3.3.14 => 3.3.14
  npmGlobalPackages:
    gatsby-cli: 2.12.107

Issue Analytics

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

github_iconTop GitHub Comments

8reactions
mxstbrcommented, Oct 12, 2020

To resolve this issue, please upgrade to the latest version of the gatsby package

The reason y’all are seeing this error is because Gatsby validates that only known APIs are exported from gatsby-node.js, even for plugins you use in your sites. We added pluginOptionsSchema as a known API and have started adding it to our core plugins.

When you upgraded the plugin packages to later versions, they exported the new pluginOptionsSchema API. However, when you don’t upgrade the gatsby package at the same time, it is not yet marked as a known API.

I’m very sorry for the troubles. 🙏 Let me know if upgrading the gatsby package to the latest version does not resolve this issue, which would be a bug.

4reactions
gitcommitshowcommented, Jan 7, 2021

Upgrading to v2.30.1 did not fix the problem. This is a great feature but I’m not able to use it. Either something in the documentation is missing or maybe it is a bug.

My context of the issue is slightly different but I’m guessing the source of the problem is the same.

  • I’m trying to use this API inside a local remark transformer plugin.
  • I don’t see the error but the debugger never reaches the breakpoint in pluginOptionsSchema. Other APIs in gatsby-node.js work fine.

I follow this guide to use pluginOptionsSchema API in my local remark transformer plugin.

Sidenote: Some inputs for making the documentation better. Can we add extra info in each API doc page to mention the version when the API was introduced? Example : Mongodb docs - it features this info on top of each components docs in this way New in version 3.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Common Errors - Gatsby
Issues with fs resolution. You may see this error because you're attempting to use fs inside a React component. Additionally, it often shows...
Read more >
Gatsby Changelog | 5.3.0
In PR #36623 we fixed this behavior and any node changes (either by changing local files or through webhook updates) will be reflected...
Read more >
gatsby-plugin-styled-components - npm
A Gatsby plugin for styled-components with built-in server-side rendering support. Install. npm install gatsby-plugin-styled-components styled- ...
Read more >
Error: The result of this StaticQuery could not be fetched. This ...
If the root of your Gatsby application is packages/ventures then Gatsby will not extract GraphQL queries from packages/shared-ui , even if ...
Read more >
How to Update Gatsby from v2 to v3 - YouTube
Gatsby released version 3. This big change can affect how future and current builds operate. I'll show you how to safely update Gatsby...
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