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

Created on 9 Oct 2020  路  7Comments  路  Source: gatsbyjs/gatsby

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 [email protected] 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
bug

Most helpful comment

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. :pray: Let me know if upgrading the gatsby package to the latest version does not resolve this issue, which would be a bug.

All 7 comments

Same than you for me :
System: OS: Windows 10 10.0.19041 CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz Binaries: Node: 12.18.4 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD Languages: Python: 3.7.7 Browsers: Chrome: 85.0.4183.121 Edge: Spartan (44.19041.423.0), Chromium (85.0.564.70) npmPackages: gatsby: ^2.24.63 => 2.24.67 gatsby-image: ^2.4.19 => 2.4.20 gatsby-plugin-catch-links: ^2.3.13 => 2.3.14 gatsby-plugin-layout: ^1.3.12 => 1.3.12 gatsby-plugin-manifest: ^2.4.30 => 2.4.33 gatsby-plugin-mdx: ^1.2.42 => 1.2.43 gatsby-plugin-nprogress: ^2.3.13 => 2.3.13 gatsby-plugin-offline: ^3.2.31 => 3.2.31 gatsby-plugin-page-progress: ^2.1.1 => 2.1.1 gatsby-plugin-react-helmet: ^3.3.11 => 3.3.12 gatsby-plugin-sharp: ^2.6.37 => 2.6.38 gatsby-plugin-sitemap: ^2.4.15 => 2.4.15 gatsby-plugin-styled-components: ^3.3.14 => 3.3.14 gatsby-plugin-theme-ui: ^0.3.0 => 0.3.0 gatsby-remark-autolink-headers: ^2.3.14 => 2.3.14 gatsby-remark-images: ^3.3.31 => 3.3.32 gatsby-remark-responsive-iframe: ^2.4.16 => 2.4.16 gatsby-remark-smartypants: ^2.3.13 => 2.3.13 gatsby-remark-wrap-iframe: ^1.1.0 => 1.1.0 gatsby-source-filesystem: ^2.3.30 => 2.3.32 gatsby-source-stripe: ^3.1.1 => 3.1.1 gatsby-transformer-sharp: ^2.5.15 => 2.5.16 npmGlobalPackages: gatsby-cli: 2.12.107

same gatsby version here. The issue is similar with the following plugin as well.

- The plugin [email protected] is using the API "pluginOptionsSchema" which is not available in your version of Gatsby.

same gatsby version here. The issue is similar with the following plugin as well.

- The plugin [email protected] is using the API "pluginOptionsSchema" which is not available in your version of Gatsby.

Same error for me here.

Same error here, builds are failing a lot.

- The plugin [email protected] is using the API "pluginOptionsSchema" which is not available in your version of Gatsby.

same on [email protected]

> gatsby build

success open and validate gatsby-configs - 0.140s

 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 [email protected] is using the API "pluginOptionsSchema" which is not available in your version of Gatsby.

upgrading to [email protected] fixed it for me

Thanks @edwmurph -- upgrading to 2.24.73 solved it for me as well. I don't think the error was causing any functional issues (atleast for me); it was just an eyesore on an otherwise error-free build

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. :pray: Let me know if upgrading the gatsby package to the latest version does not resolve this issue, which would be a bug.

Was this page helpful?
0 / 5 - 0 ratings