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.

CodeSHA256 is different from current CodeSHA256 in $LATEST

See original GitHub issue

This is a Bug Report

Description

For bug reports:

  • What went wrong?

After upgrading to Serverless 1.14.0, I’m now getting:

Serverless: Deployment failed!
 
  Serverless Error ---------------------------------------
 
     An error occurred while provisioning your stack: SaveAttachmentLambdaVersionXX
     - CodeSHA256 (XX)
     is different from current CodeSHA256 in $LATEST (XX).
     Please try again with the CodeSHA256 in $LATEST..
  • What did you expect should have happened?

New deployment should have succeeded

  • What was the config you used?

Deploying to AWS. Using serverless-plugins-typescript to compile TS to a .build folder before deployment.

  • What stacktrace or error message from your provider did you see?
ServerlessError: An error occurred while provisioning your stack: SaveSearchLambdaVersionXXX- CodeSHA256 (XXX) is different from current CodeSHA256 in $LATEST (XXX). Please try again with the CodeSHA256 in $LATEST..
    at provider.request.then (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:109:33)
From previous event:
    at AwsDeploy.monitorStack (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:26:12)
    at provider.request.then (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:88:30)
From previous event:
    at AwsDeploy.update (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:88:8)
From previous event:
    at AwsDeploy.BbPromise.bind.then (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:105:12)
From previous event:
    at AwsDeploy.updateStack (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:99:8)
From previous event:
    at Object.aws:deploy:deploy:updateStack [as hook] (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:99:10)
    at BbPromise.reduce (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:234:55)
From previous event:
    at PluginManager.invoke (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:234:22)
    at PluginManager.spawn (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:246:17)
    at AwsDeploy.BbPromise.bind.then (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:85:48)
From previous event:
    at Object.deploy:deploy [as hook] (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:81:10)
    at BbPromise.reduce (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:234:55)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
    at PluginManager.invoke (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:234:22)
    at PluginManager.run (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:253:17)
    at variables.populateService.then (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/Serverless.js:100:33)
From previous event:
    at Serverless.run (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/lib/Serverless.js:87:74)
    at serverless.init.then (/Users/cmmoyer/.nvm/v6.10.1/lib/node_modules/serverless/bin/serverless:23:50)

Additional Data

  • Serverless Framework Version you’re using: 1.14.0
  • Operating System: darwin (macOS 10.12.4)
  • Stack Trace: See above
  • Provider Error messages: CodeSHA256 (XX) is different from current CodeSHA256 in $LATEST (XX)
  • Node Version: v6.10.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
thomaswmanioncommented, Aug 24, 2017

Adding versionFunctions: false to the provider property of serverless.yml is a possible workaround.

11reactions
unfor19commented, Nov 28, 2019

For me, it happened because I used the same filename in artifact for two functions So I renamed the ZIP files … and now it works

The issue:

functions:
  statusBadge:
    handler: index.handler
    package:
      artifact: ./services/commit-badges/dist/dist.zip
...

functions:
  statusBadge:
    handler: index.handler
    package:
      artifact: ./services/status-badges/dist/dist.zip

Solution:

functions:
  statusBadge:
    handler: index.handler
    package:
      artifact: ./services/commit-badges/dist/dist_commit_badges.zip
...

functions:
  statusBadge:
    handler: index.handler
    package:
      artifact: ./services/status-badges/dist/dist_status_badges.zip
Read more comments on GitHub >

github_iconTop Results From Across the Web

Manual deployment through AWS Console, help with update ...
CodeSHA256 (***) is different from current CodeSHA256 in $LATEST (***). Please try again with the CodeSHA256 in $LATEST.
Read more >
How to calculate the CodeSha256 of aws lambda deployment ...
zip is the package I had uploaded. What I'd like to be able to do, for an existing lambda, is generate the sha256...
Read more >
serverless/serverless - Gitter
Hi everyone, I am trying to deploy new function in the same service using "sls deploy function -f ... is different from current...
Read more >
CodeSHA256 is different from current CodeSHA256 in $LATEST
This is a Bug Report. Description. For bug reports: What went wrong? After upgrading to Serverless 1.14.0, I'm now getting:
Read more >
FunctionConfiguration - AWS Lambda
Array Members: Fixed number of 1 item. Valid Values: x86_64 | arm64. Required: No. CodeSha256. The SHA256 hash of the function's deployment package....
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