Skip to content

Error in Individual Deployment of Function #414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ndanielsen opened this issue Oct 3, 2019 · 29 comments
Closed

Error in Individual Deployment of Function #414

ndanielsen opened this issue Oct 3, 2019 · 29 comments
Labels

Comments

@ndanielsen
Copy link

Getting an error when trying to deploy an individual function:

command:
sls deploy function -f functionName


  Type Error ---------------------------------------------
 
  TypeError: Cannot read property 'artifact' of undefined

Your Environment Information ---------------------------
Operating System: darwin
Node Version: 10.16.0
Framework Version: 1.53.0
Plugin Version: 3.1.0
SDK Version: 2.1.1
Components Core Version: 1.1.1
Components CLI Version: 1.2.3

with this version:
"serverless-python-requirements": "^5.0.0"

@jonathanabila
Copy link

Just to include a few more details:

sls deploy --function observed_daily --stage dev

Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command requirements
Serverless: Load command requirements:clean
Serverless: Load command requirements:install
Serverless: Load command requirements:cleanCache
Serverless: Load command create_domain
Serverless: Load command delete_domain
Serverless: Load command offline
Serverless: Load command offline:start
Serverless: DOTENV: Loading environment variables from .env:
Serverless: 	 - AWS_BUCKET_NAME
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Invoke deploy
Serverless: Invoke deploy:function
Serverless: [AWS lambda 200 0.742s 0 retries] getFunction({ FunctionName: 'broly-dev-observed_daily' })
Serverless: Generated requirements from /home/jonathanabila/broly/requirements.txt in /home/jonathanabila/broly/.serverless/requirements.txt...
Serverless: Installing requirements from /home/jonathanabila/broly/.serverless/requirements/requirements.txt ...
Serverless: Running ...
Serverless: Invoke package:function
Serverless: Packaging function: observed_daily...
Serverless: Excluding development dependencies...
 
  Type Error ---------------------------------------------
 
  TypeError: Cannot read property 'artifact' of undefined
      at ServerlessPythonRequirements.BbPromise.bind.then.then.then (/home/jonathanabila/broly/node_modules/serverless-python-requirements/index.js:185:48)
  From previous event:
      at PluginManager.invoke (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:505:22)
      at PluginManager.spawn (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:525:17)
      at Deploy.BbPromise.bind.then (/usr/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:110:50)
  From previous event:
      at Object.before:deploy:deploy [as hook] (/usr/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:100:30)
      at BbPromise.reduce (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:505:55)
  From previous event:
      at PluginManager.invoke (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:505:22)
      at getHooks.reduce.then (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:540:24)
  From previous event:
      at PluginManager.run (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:540:8)
      at variables.populateService.then (/usr/lib/node_modules/serverless/lib/Serverless.js:115:33)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)
  From previous event:
      at Serverless.run (/usr/lib/node_modules/serverless/lib/Serverless.js:102:74)
      at serverless.init.then (/usr/lib/node_modules/serverless/bin/serverless.js:72:30)
      at /usr/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:111:16
      at /home/jonathanabila/broly/node_modules/graceful-fs/graceful-fs.js:57:14
      at /usr/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:45:10
      at FSReqWrap.args [as oncomplete] (fs.js:140:20)
  From previous event:
      at initializeErrorReporter.then (/usr/lib/node_modules/serverless/bin/serverless.js:72:8)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)
  From previous event:
      at Object.<anonymous> (/usr/lib/node_modules/serverless/bin/serverless.js:57:4)
      at Module._compile (internal/modules/cjs/loader.js:778:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
 
  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.16.3
     Framework Version:         1.53.0
     Plugin Version:            3.1.1
     SDK Version:               2.1.1
     Components Core Version:   1.1.1
     Components CLI Version:    1.2.3

Python requirements version:
[email protected]

@ndanielsen
Copy link
Author

Seems like a regression on this issue:

#161

@nicholasball
Copy link

nicholasball commented Oct 7, 2019

getting the same issue on a function deployment:

Operating System: darwin
Node Version: 7.5.0
Framework Version: 1.52.2
Plugin Version: 3.0.0
SDK Version: 2.1.1

@roberto-d
Copy link

Just bumped in the same problem:

Your Environment Information ---------------------------
Operating System: darwin
Node Version: 10.16.3
Framework Version: 1.53.0
Plugin Version: 3.1.1
SDK Version: 2.1.1
Components Core Version: 1.1.1
Components CLI Version: 1.2.3

@jonathanabila
Copy link

The error continues in the newer version:

> sls deploy --function observed_daily --stage dev
Serverless: Installing requirements of requirements.txt in .serverless...
Serverless: Packaging function: observed_daily...
Serverless: Excluding development dependencies...
 
  Type Error ---------------------------------------------
 
  TypeError: Cannot read property 'artifact' of undefined
      at ServerlessPythonRequirements.BbPromise.bind.then.then (/home/jonathanabila/nimbus/node_modules/serverless-python-requirements/index.js:148:48)
      at ServerlessPythonRequirements.tryCatcher (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/promise.js:512:31)
      at Promise._settlePromise (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/promise.js:569:18)
      at Promise._settlePromise0 (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/promise.js:614:10)
      at Promise._settlePromises (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/promise.js:694:18)
      at _drainQueueStep (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/async.js:138:12)
      at _drainQueue (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/async.js:131:9)
      at Async._drainQueues (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/async.js:147:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/home/jonathanabila/nimbus/node_modules/bluebird/js/release/async.js:17:14)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  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.16.3
     Framework Version:         1.54.0
     Plugin Version:            3.1.2
     SDK Version:               2.1.2
     Components Core Version:   1.1.1
     Components CLI Version:    1.2.

@mindlapse
Copy link

same here

1 similar comment
@jiamingz42
Copy link

same here

@NourDT
Copy link

NourDT commented Oct 16, 2019

yup - same issue.

@NSpehler
Copy link

Same here 👆

@anaselmhamdi
Copy link

Same here !

@ndanielsen
Copy link
Author

Just put up PR (patch job) to get this working for others (and myself!). No tests yet ☠️

Any feedback or better ways to this are appreciated!

@Mlysiu
Copy link

Mlysiu commented Nov 29, 2019

hey, any update on this?

@gideonaa
Copy link

gideonaa commented Dec 5, 2019

+1 for this issue. Deploying one function at a time is a huge time-saver.

@szto-ain
Copy link

I need update! It's huge pain.

@christianbridgers
Copy link

Same issue here!

@tituskruse1
Copy link

i have the same issue.

@miketheman miketheman added the bug label Feb 19, 2020
@arthurliebhardt
Copy link

+1

@imaduddinamajid
Copy link

Got similar issue

@Filip-Duc
Copy link

any update on this?

@shredding
Copy link

+1

@VictorIsra
Copy link

same issue here...

@zees-dev
Copy link

+1

@felipeparpinelli
Copy link

I fixed this with a workaround found here:
serverless/serverless#6752 (comment)

@cloud-dev0102
Copy link

functions:
  handler:
    handler: functions/handler.handler
    package: {} # This fixes the issue.
    events:
      - http:
          path: /map
          method: post
          cors: true

@corydodt
Copy link

corydodt commented Jan 1, 2021

functions:
  handler:
    handler: functions/handler.handler
    package: {} # This fixes the issue.
    events:
      - http:
          path: /map
          method: post
          cors: true

fixed it for me ty!

@oca159
Copy link

oca159 commented Jan 27, 2021

How do you exlude files and folders if you are using package: {}

@cloud-dev0102
Copy link

cloud-dev0102 commented Jan 28, 2021

How do you exlude files and folders if you are using package: {}

I have passed through a specific path for the function.

  • Deploy the serverless project
  • Temporarily remove the packages unimported into the function body
  • Separately deploy the function again.

serverless deploy function -f <function_name>

In fact, this is a boring performance, but as long as this package has the issue, it is a way to bypass it.

@b4brijesh
Copy link

This is supposedly fixed now #490. Still waiting for the next release to use and test this fix.

@pgrzesik
Copy link
Contributor

pgrzesik commented Dec 3, 2021

Closing this one as the fix was included in one of the past releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.