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
Upgrading gatsby from 2.0.31 to 2.0.34 causes a Typerror #9559
Comments
@jonleopard would you be able to provide a reproduction? For context, this is the line that appears to be throwing: function createNodeId(id, namespace) {
return uuidv5(id, uuidv5(namespace, seedConstant)); // here
} |
I had the same issue, in gatsyb-config.js file I had this:
instead of simply
|
Thanks @Greegko, that worked for me! Mind if I ask how you managed to trace down that issue? |
@jonleopard Put console.log() with related context parameters before every createNodeId imported and called, at one place there was an undefined and more console log until I found it iterated over all plugins which gave me the plugin name. Just saw the differences between plugin declaration afterwards. |
Nice find @Greegko! Looks like you have to either use the shorthand syntax or at least supply an empty options object. Is that intentional? I was using the object syntax exclusively since having a uniform style made it clearer to read the plugins list. |
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
],
},
} |
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 :) |
Thank you @Greegko, this was very helpful! |
Thank you @kinduff !! |
@DSchau Hmm, I'm getting the same error after an update to Gatsby Edit: regression introduced in 2.0.33 |
Local plugin stopped working with same error since |
@jedrichards @cmsbased just to clarify, by a local plugin you mean a project level Do either of you have a reproduction handy? Otherwise I'll just make one quickly to confirm! Also here's the diff between 2.0.32 and 2.0.33 |
I've attempted to reproduce the issue here (using gatsby 2.0.35), and unable to do so. Possible there's a misunderstanding here, so would either of you be able to reproduce here? I've added you both as collaborators. |
@DSchau @cmsbased I've managed to repro a bug. Here's a PR demoing it: Looks like it occurs for me when package.json in the local plugin is the empty object https://www.gatsbyjs.org/docs/plugin-authoring/#what-files-does-gatsby-look-for-in-a-plugin |
@DSchau It is a local plugin \gatsby-site\plugins\gatsby-source-custom gatsby-config.js is set like this:
Need to roll it back to version 2.0.31 to make it work. Problem persists with empty plugin. |
@jedrichards so the issue there is due to this change We just need to tweak that logic a bit. @cmsbased I don't think it's config related, do you also have an empty package.json? |
@DSchau Yes. Empty package.json with |
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! |
Fixed in |
@DSchau thanks for checking this out! I'm still seeing the same error in 2.0.37. Here's my gatsby-config.js: module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-react-helmet'
}
]
} adding an empty |
@zvinless that seems like a separate issue! Interesting in fixing it? It's probably a regression introduced in the same release (2.0.33) I posted above! |
Sure, I'll give it a shot |
<!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ --> Fixes issue at the end of #9559, e.g.: ```javascript module.exports = { plugins: [ { resolve: 'gatsby-plugin-react-helmet' } ] } ``` where the plugin is loaded using object syntax but no `options` object is defined. This wasn't caught by the unit test because the issue was occurring after the early out when it's the `___TEST___` plugin.
<!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ --> Fixes issue at the end of gatsbyjs#9559, e.g.: ```javascript module.exports = { plugins: [ { resolve: 'gatsby-plugin-react-helmet' } ] } ``` where the plugin is loaded using object syntax but no `options` object is defined. This wasn't caught by the unit test because the issue was occurring after the early out when it's the `___TEST___` plugin.
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:
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(R) Core(TM) 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
The text was updated successfully, but these errors were encountered: