floydspace / serverless-esbuild

💨 A Serverless framework plugin to bundle JavaScript and TypeScript with extremely fast esbuild
MIT License
452 stars 138 forks source link

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

Open jcsofts opened 1 year ago

jcsofts commented 1 year ago

Describe the bug I have a serverless project with typescript it works find on local test with(serverless-offline)

I try to deploy a serverless project use the ecr(docker) of aws

when run serverless deploy to deploy the project got below error:

Screenshots or Logs Error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:387:5) at validateString (node:internal/validators:121:11) at Object.basename (node:path:1309:5) at EsbuildServerlessPlugin.moveArtifacts (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless-esbuild/dist/index.js:337:102) at async EsbuildServerlessPlugin.cleanup (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless-esbuild/dist/index.js:340:9) at async after:package:createDeploymentArtifacts (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless-esbuild/dist/index.js:83:17) at async PluginManager.runHooks (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/classes/plugin-manager.js:530:9) at async PluginManager.invoke (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/classes/plugin-manager.js:565:9) at async PluginManager.spawn (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/classes/plugin-manager.js:585:5) at async before:deploy:deploy (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/plugins/deploy.js:40:11) at async PluginManager.runHooks (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/classes/plugin-manager.js:530:9) at async PluginManager.invoke (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/classes/plugin-manager.js:563:9) at async PluginManager.run (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/classes/plugin-manager.js:604:7) at async Serverless.run (/Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/lib/serverless.js:179:5) at async /Users/lee/Develop/php/app-crm/src/app-node-pipe/node-server/node_modules/serverless/scripts/serverless.js:819:9

Versions (please complete the following information): "esbuild": "^0.17.18", "esbuild-loader": "^3.0.1", "serverless": "^3.21.0", "serverless-esbuild": "^1.43.1", "serverless-offline": "^12.0.4", "serverless-plugin-typescript": "^2.1.2",

plugins:
jcsofts commented 1 year ago

this is the serverless.yml file

` service: app-node frameworkVersion: '3'

provider: name: aws runtime: nodejs16.x architecture: x86_64 profile: ${env:ECR_PROFILE} ecr: images: pipe-node-server: path: ./ platform: linux/amd64

functions: api: image: name: pipe-node-server events:

plugins:

custom: esbuild: bundle: true minify: false keepOutputDirectory: true `

jcsofts commented 1 year ago

the error is throw at this line service.package.artifact = path_1.default.join(constants_1.SERVERLESS_FOLDER, path_1.default.basename(service.package.artifact)); at this line the service.package.artifact is undefined

mmarinaccio commented 1 year ago

@jcsofts Did you ever figure this out? Running into the same problem.

mmarinaccio commented 1 year ago

Ah I think I figured it out. Just had to add individually: true to the package portion of serverless.yml.

image

Not sure if this is a bug or just missing documentation.