serverless-plugin-typescript icon indicating copy to clipboard operation
serverless-plugin-typescript copied to clipboard

[ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

Open pavannaik028 opened this issue 4 years ago • 3 comments

Hi All,

we are seeing the error "[ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined" after adding the serverless-bundle plugin.

error stack: erverless: Auto instrumenting functions with Datadog Serverless: Adding Lambda Layers to functions Serverless: Compiling with Typescript... Serverless: Using local tsconfig.json Serverless: Typescript compiled. Serverless: Invoke webpack:validate Serverless: Invoke webpack:compile Serverless: Bundling with Webpack... Serverless: Invoke webpack:package Serverless: No external modules needed Serverless: Packaging service...

Type Error ---------------------------------------------

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:277:15) at validateString (node:internal/validators:123:11) at Object.basename (node:path:1156:5) at TypeScriptPlugin. (node_modules/serverless-plugin-typescript/src/index.ts:203:12) at Generator.next () at fulfilled (node_modules/serverless-plugin-typescript/dist/src/index.js:4:58) From previous event: at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:521:22) at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:556:24 From previous event: at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:556:8) at /usr/local/lib/node_modules/serverless/lib/Serverless.js:203:33 at processImmediate (node:internal/timers:463:21) From previous event: at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:190:74) at /usr/local/lib/node_modules/serverless/scripts/serverless.js:50:26

in serverless.yml

plugin:

  • serverless-plugin-typescript
  • serverless-plugin-datadog
  • serverless-plugin-include-dependencies
  • serverless-dependson-plugin
  • serverless-offline
  • serverless-bundle

Thank you

pavannaik028 avatar Jan 21 '21 06:01 pavannaik028

I only get this error when working with layers (for the entire node_modules) and try to deploy only one function... No problems to deploy the entire stack... No problems when not using layers, to deploy a single function...

Marcosl14 avatar Jan 23 '23 16:01 Marcosl14

@Marcosl14

Did you have serverless.yml and tsconfig.json in different locations? I do and I can't make it work at all

nbcchen avatar Mar 22 '23 17:03 nbcchen

No... They are in the same location...

Marcosl14 avatar Jun 07 '23 15:06 Marcosl14