question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploy function not update function code in AWS Lambda but just deploy updates

See original GitHub issue

This is a Bug Report

Description

if I try to deploy a single function ( only one function is giving me problem) the deploy process is finished with success but no event is generated in cloud Formation for the service and the code for the function is not updated. But if I deploy the whole service with serverless deploy the function is deployed without a problem.

I think only functions that are too big for inline change directly in aws console have this problem. Not sure, this is the second function that I have problem with and the first was too big to see the code in aws console too.

For bug reports:

  • What went wrong? serverless deploy function return success and didn’t update the code but serverless deploy updates the code

  • What did you expect should have happened? the code to be updated after deploy function funish

  • What was the config you used? serverless version 1.24.1 node.js 6.10

  • What stacktrace or error message from your provider did you see? No erros. Serverless on debug mode don’t show any errors. and there is no event at cloud formation ( so no errors there too )

Additional Data

  • Serverless Framework Version you’re using: serverless version 1.24.1

  • Operating System: ubuntu 16.04

  • Stack Trace:

Serverless: Load command run
Serverless: Load command config
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 login
Serverless: Load command logout
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 emit
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command webpack
Serverless: Load command webpack:invoke
Serverless: Load command webpack:watch
Serverless: Load command webpack:serve
Serverless: WARNING: Plugin ServerlessWebpack uses deprecated hook before:deploy:createDeploymentArtifacts,
                     use package:createDeploymentArtifacts hook instead
Serverless: WARNING: Plugin ServerlessWebpack uses deprecated hook after:deploy:createDeploymentArtifacts,
                     use package:createDeploymentArtifacts hook instead
Serverless: Load command prune
Serverless: Load command offline
Serverless: Load command offline:start
Serverless: Invoke deploy:function
Serverless: Bundling with Webpack...
<<webpack output>>
Serverless: Invoke package:function
Serverless: Packaging function: getResource...
Serverless: Uploading function: getResource (661.61 KB)...
Serverless: Successfully deployed function: getResource
Serverless: Successfully updated function: getResource
Serverless: Invoke aws:common:cleanupTempDir
  • Provider Error messages: No logs at aws. The deploy process to AWS probably was never started.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
HyperBraincommented, Feb 16, 2018

I got one deploy failure yesterday

Yes, that will have eliminated the function deploys because they are not tracked by CF.

A general approach is, to use “function deploy” for debugging (as you said it’s much faster if you just want to test a debug version or some changes) and only use “deploy” for production.

1reaction
HyperBraincommented, Feb 16, 2018

Thanks, and the PR is in 1.26.

serverless deploy --function uses the AWS REST API to update the function and bypasses CloudFormation completely. So we cannot compare deploy with deploy function at all. BTW: deploy function should not be used in production systems as it leaves the CF state inconsistent and any rollback in your stack will have unexpected results.

That’s also the reason why you do not see anything happen in the CloudFormation event tab.

From the logs it looks ok though:

Serverless: Packaging function: getResource...
Serverless: Uploading function: getResource (661.61 KB)...
Serverless: Successfully deployed function: getResource
Serverless: Successfully updated function: getResource

Did you try to invoke the function after you deployed it separately?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot deployment issues in Lambda
When you update your function, Lambda deploys the change by launching new instances of the function with the updated code or settings. Deployment...
Read more >
Step 3: Deploy the updated Lambda function
In this step, you use your updated myDateTimeFunction.js to update and initiate the deployment of your Lambda function. You can monitor the deployment...
Read more >
Step 2: Update the Lambda function - AWS CodeDeploy
In this topic, you update your myDateTimeFunction.js file. In the next step, you use the file to deploy the updated function. This triggers...
Read more >
UpdateFunctionCode - AWS Lambda
Set to true to publish a new version of the function after updating the code. This has the same effect as calling PublishVersion...
Read more >
update-function-code — AWS CLI 1.27.37 Command Reference
Enter the Amazon S3 bucket and key of the code .zip file location. ... Use only with a function defined with a .zip...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found