TypeError: Cannot convert undefined or null to object
See original GitHub issueHi there,
I receive the TypeError: Cannot convert undefined or null to object
on version 1.25.0
of your plugin, 'till version 1.24.1
it has been working seamlessly. My esbuild configuration is
esbuild: {
minify: false,
bundle: true,
sourcemap: offline,
keepNames: true,
logLevel: 'debug',
legalComments: 'none',
...(offline && { nodePaths }),
// if not offline don't bundle the layer package otherwise bundle them but aws-crt
...((!offline && { external }) || { external: ['aws-crt'] })
}
Environment: darwin, node 17.4.0, framework 3.5.1 (local), plugin 6.1.3, SDK 4.3.2
the error stack is:
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at convertTrees (.../node_modules/serverless-esbuild/dist/packagers/npm.js:85:27)
at NPM.getProdDependencies (.../node_modules/serverless-esbuild/dist/packagers/npm.js:141:27)
at async EsbuildServerlessPlugin.pack (.../node_modules/serverless-esbuild/dist/pack.js:125:11)
at async before:package:createDeploymentArtifacts (.../node_modules/serverless-esbuild/dist/index.js:83:17)
at async PluginManager.runHooks (.../node_modules/serverless/lib/classes/plugin-manager.js:530:9)
at async PluginManager.invoke (.../node_modules/serverless/lib/classes/plugin-manager.js:563:9)
at async PluginManager.spawn (.../node_modules/serverless/lib/classes/plugin-manager.js:585:5)
at async before:deploy:deploy (.../node_modules/serverless/lib/plugins/deploy.js:40:11)
at async PluginManager.runHooks (.../node_modules/serverless/lib/classes/plugin-manager.js:530:9)
at async PluginManager.invoke (.../node_modules/serverless/lib/classes/plugin-manager.js:563:9)
at async PluginManager.run (.../node_modules/serverless/lib/classes/plugin-manager.js:604:7)
at async Serverless.run (.../node_modules/serverless/lib/serverless.js:174:5)
at async .../node_modules/serverless/scripts/serverless.js:687:9
I would like to maintain your package updated. Cheers!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Cannot convert undefined or null to object - Stack Overflow
Generic answer. This error is caused when you call a function that expects an Object as its argument, but pass undefined or null...
Read more >Cannot convert undefined or null to Object in JavaScript
The "Cannot convert undefined or null to Object" error occurs when we pass a null or an undefined value to a function that...
Read more >Object.keys(null) possible - cannot convert undefined or null to ...
Conditions above this line allow msg===null to get into Object.keys(msg);. livedata_connection.js:1626 Uncaught TypeError: Cannot convert ...
Read more >Cannot convert undefined or null to object - YouTube
JavaScript : How to resolve TypeError : Cannot convert undefined or null to object [ Gift : Animated Search Engine ...
Read more >Error: "TypeError: Cannot convert undefined or nul...
Error: "TypeError: Cannot convert undefined or null to object" with Publish to Tableau Server tool. Article Options.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Sam, thank you for the prompt support. This is the console log output:
I think the problem is that, having an external layer for dependencies, I have only
devDependency
in the main serverless package.json soparsedDeps.dependencies
is empty. I think this could be a common use case 😄 . Maybe converting the tree could be skipped in this case. Cheers!Thank you! The change I made was based on no existing unit tests so thank you for that! Much appreciated!