serverless / serverless-python-requirements

βš‘οΈπŸπŸ“¦ Serverless plugin to bundle Python packages
MIT License
1.11k stars 291 forks source link

Error when no Lambda function: TypeError [ERR_INVALID_ARG_TYPE]: The 'path' argument must be of type string, Buffer, or URL #842

Open junah201 opened 4 months ago

junah201 commented 4 months ago

Are you certain it's a bug?

Are you using the latest plugin release?

Is there an existing issue for this?

Issue description

When no Lambda function, serverless-python-requirement receive TypeError. I know that this is not a common use case. But serverless-python-requirement should handle these exceptions.

I will add a PR related to this issue soon.

Service configuration (serverless.yml) content

service: sls-bug-test

provider:
  name: aws
  runtime: python3.10
  region: ap-northeast-2

package:
  include:
    - "requirements.txt"
  exclude:
    - "node_modules/**"

plugins:
  - serverless-python-requirements

Command name and used flags

sls deploy

Command output

βœ– The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at readFile (node:fs:409:10)
    at go$readFile (file:///C:/Users/junah/.serverless/releases/4.1.6/package/dist/sf-core.js:3:1334)
    at readFile8 (file:///C:/Users/junah/.serverless/releases/4.1.6/package/dist/sf-core.js:3:1244)
    at go$readFile (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\graceful-fs\graceful-fs.js:118:14)
    at Object.readFile (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\graceful-fs\graceful-fs.js:115:12)
    at Object.readFile (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\universalify\index.js:5:57)
    at Object.tryCatcher (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\util.js:16:23)
    at Object.ret [as readFileAsync] (eval at makeNodePromisifiedEval (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\promisify.js:184:12), <anonymous>:14:23)
    at injectRequirements (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\serverless-python-requirements\lib\inject.js:30:6)
    at ServerlessPythonRequirements.injectAllRequirements (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\serverless-python-requirements\lib\inject.js:169:13)
    at ServerlessPythonRequirements.<anonymous> (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\serverless-python-requirements\index.js:243:43)
    at ServerlessPythonRequirements.tryCatcher (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\promise.js:729:18)
    at _drainQueueStep (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\async.js:102:5)
    at Async.drainQueues [as _onImmediate] (C:\Users\junah\OneDrive\바탕 ν™”λ©΄\sls bug test\node_modules\bluebird\js\release\async.js:15:14)
    at process.processImmediate (node:internal/timers:476:21)

For help, try the following:
  β€’ Run the command again with the "--debug" option
  β€’ Run "serverless support"
  β€’ Review the docs: https://www.serverless.com/framework/docs/

Environment information

serverless framework = 4.1.6
serverless-python-requirements = 6.1.0
satpai1215 commented 1 month ago

Just bumping this as I'm running into the same issue.

It looks like it was fixed with the update in https://github.com/serverless/serverless-python-requirements/pull/843 , however is this going to get released?