gatsby: Upgrading gatsby from 2.0.31 to 2.0.34 causes a Typerror

Not sure what’s causing this, it may be a plugin but I’m not sure where to even start.

Description

Upgrading gatsby from 2.0.31 to 2.0.34 causes a typerror:

$ gatsby develop                                                                                                                                               [75/2399]
success open and validate gatsby-configs — 0.011 s
error value must be an array of bytes


  TypeError: value must be an array of bytes

  - v35.js:29 generateUUID
    [jonleopard.com]/[uuid]/lib/v35.js:29:38

  - create-node-id.js:16 createNodeId
    [jonleopard.com]/[gatsby]/dist/utils/create-node-id.js:16:10

  - load.js:131 processPlugin
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/load.js:131:13

  - load.js:148 config.plugins.forEach.plugin
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/load.js:148:20

  - Array.forEach

  - load.js:147 module.exports
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/load.js:147:20

  - index.js:56
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/index.js:56:21

  - Generator.next

  - debuggability.js:313 Promise._execute
    [jonleopard.com]/[bluebird]/js/release/debuggability.js:313:9

  - promise.js:483 Promise._resolveFromExecutor
    [jonleopard.com]/[bluebird]/js/release/promise.js:483:18

  - promise.js:79 new Promise
    [jonleopard.com]/[bluebird]/js/release/promise.js:79:10

  - index.js:96
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/index.js:96:17


error UNHANDLED REJECTION


  TypeError: value must be an array of bytes

  - v35.js:29 generateUUID
    [jonleopard.com]/[uuid]/lib/v35.js:29:38

  - create-node-id.js:16 createNodeId
    [jonleopard.com]/[gatsby]/dist/utils/create-node-id.js:16:10

  - load.js:131 processPlugin
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/load.js:131:13

  - load.js:148 config.plugins.forEach.plugin
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/load.js:148:20

  - Array.forEach

  - load.js:147 module.exports
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/load.js:147:20

  - index.js:56
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/index.js:56:21

  - Generator.next

  - debuggability.js:313 Promise._execute
    [jonleopard.com]/[bluebird]/js/release/debuggability.js:313:9

  - promise.js:483 Promise._resolveFromExecutor
    [jonleopard.com]/[bluebird]/js/release/promise.js:483:18

  - promise.js:79 new Promise
    [jonleopard.com]/[bluebird]/js/release/promise.js:79:10

  - index.js:96
    [jonleopard.com]/[gatsby]/dist/bootstrap/load-plugins/index.js:96:17

Steps to reproduce

Upgraded all my gatsby plgugins as well as gatsby/gatsby-cli to the latest versions.

Expected result

gatsby develop should start with no errors.

Actual result

Received TypeError: value must be an array of bytes

Environment

System: OS: macOS 10.14 CPU: x64 Intel® Core™ i7-7920HQ CPU @ 3.10GHz Shell: 5.6.2 - /usr/local/bin/zsh Binaries: Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node Yarn: 1.10.1 - /usr/local/bin/yarn npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm Browsers: Chrome: 69.0.3497.100 Firefox: 63.0 Safari: 12.0 npmPackages: gatsby: ^2.0.34 => 2.0.34 gatsby-cli: ^2.4.4 => 2.4.4 gatsby-codemods: ^1.0.6 => 1.0.6 gatsby-plugin-google-analytics: ^2.0.7 => 2.0.7 gatsby-plugin-netlify: ^2.0.3 => 2.0.3 gatsby-plugin-react-helmet: ^3.0.1 => 3.0.1 gatsby-plugin-sharp: ^2.0.10 => 2.0.10 gatsby-plugin-sitemap: ^2.0.2 => 2.0.2 gatsby-plugin-styled-components: ^3.0.1 => 3.0.1 gatsby-remark-prismjs: ^3.0.3 => 3.0.3 gatsby-source-contentful: ^2.0.9 => 2.0.9 gatsby-source-filesystem: ^2.0.6 => 2.0.6 gatsby-transformer-json: ^2.1.5 => 2.1.5 gatsby-transformer-remark: ^2.1.11 => 2.1.11 gatsby-transformer-sharp: ^2.1.7 => 2.1.7

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 23 (18 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same issue, in gatsyb-config.js file I had this:

module.exports = {
plugins: [
{
      resolve: `gatsby-plugin-sitemap`,
},
...
]

instead of simply

plugins: ['gatsby-plugin-sitemap', ...]

Right, so the logic to tweak here is pretty simple!

In this file

we need to get the name up front, and then use it, e.g. like so:

const name = packageJSON.name || pluginName
return {
  resolve: resolvedPath,
  name,
  id: createNodeId(name, `Plugin`),
  version:
    packageJSON.version || createFileContentHash(resolvedPath, `**`),
}

either of you want to PR that? I’d appreciate it, otherwise I’ll get to it soon!

Yeah, so to sum up here, it looks like leaving options off a plugin with resolve reliably throws the error, correct?

We should fix it! Anyone want to jump on this? I’ll close this one out and create a new issue in a second 😃

I can confirm that the fix provided by @Greegko fixes the issue.

Before

{
  resolve: `gatsby-transformer-remark`,
  options: {
    plugins: [
      {
        resolve: `gatsby-remark-relative-images`,
        options: {
          name: 'assets'
        }
      },
      {
        resolve: `gatsby-remark-images`,
      },
    ],
  },
}

After

{
  resolve: `gatsby-transformer-remark`,
  options: {
    plugins: [
      {
        resolve: `gatsby-remark-relative-images`,
        options: {
          name: 'assets'
        }
      },
      `gatsby-remark-images`, // changed
    ],
  },
}