serverless-plugin-tree-shake
serverless-plugin-tree-shake copied to clipboard
Type Error [ E R R_ I N V A L I D_ A R G_ T Y P E] -----
The plugin is dumping this issue right now on linux and osx.
Serverless: Packaging service...
Type Error [ E R R_ I N V A L I D_ A R G_ T Y P E] -----
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean
at validateString (internal/validators.js:125:11)
at Object.resolve (path.js:1080:7)
at Promise.all.files.map.file (/src/packages/parser/node_modules/@vercel/nft/out/node-file-trace.js:32:29)
at Array.map (<anonymous>)
at nodeFileTrace (/src/packages/parser/node_modules/@vercel/nft/out/node-file-trace.js:31:29)
at module.exports.resolveFilePathsFunction (/src/packages/parser/node_modules/serverless-plugin-tree-shake/index.js:510:47)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 10.23.0
Framework Version: 2.10.0 (local)
Plugin Version: 4.1.1
SDK Version: 2.3.2
Components Version: 3.3.0
From inspecting the source, it looks like it's failing to read the entrypoint from one of my ~30 functions. How do I know which one? How do I know why?
Have you tried to add a console.log
to the resolveFilePathsFunction
function?
https://github.com/sergioramos/serverless-plugin-tree-shake/blob/af80b6befb57b4fadd3c62619dec1f2ee0816529/index.js#L401
Actually, I have a better idea:
module.exports = class {
const allFiles = await Map(
this.serverless.service.getAllFunctions(),
(fnName) => {
- return this.resolveFilePathsFunction(fnName);
+ return this.resolveFilePathsFunction(fnName).catch((error) => {
+ console.error(error, { fnName });
+ return [];
+ });
},
);