serverless-aws-alias icon indicating copy to clipboard operation
serverless-aws-alias copied to clipboard

redeploy alias fail: AWS::Lambda::Version is not supported

Open lintaonz opened this issue 6 years ago • 4 comments

Serverless version: 1.19 serverless-aws-alias: 1.5

When I try to update my alias with follow command:

node ./node_modules/serverless/bin/serverless deploy --alias uat

My CF stack update fail with follow error:

21:21:24 UTC+1300 | UPDATE_FAILED | AWS::Lambda::Version | TransactionDashapiLambdaVersionwpEeyV9wDnRLKYRD3XkwKYtOdI8WBZjxYEFe9pQ2eCw | Update to resource type AWS::Lambda::Version is not supported.

I have used above command to create the uat stage and update my function once successfully. But when I try to run the deploy command the 3rd time, this error happen. And my CF stack fail since then.

How can I fix this?

Thanks,

lintaonz avatar Sep 30 '17 08:09 lintaonz

I believe I found the issue. The problem is the alias description. As I try to use CI server to deploy serverless. I use lambda function description to store my build-number and commit-hash. So my description like this: handler: index.handler description: "build: ${env:DEPLOY_TAG}, commit: ${env:SHORT_COMMIT}"

It seems the CF update stack cloudformation-template-update-alias-stack.json fail to delete the old alias once the alias' description is changed. The same error will happen if you run 'deploy function' as it will add 'Deployed manually' to the description.

Can the CF update stack don't check the alias description during the deployment?

lintaonz avatar Sep 30 '17 09:09 lintaonz

Hi @lintaonz ,

I have to analyze this. Strange is, that the error states that the resource cannot be changed to an AWS::Version resource. Do you use any other plugins in parallel? We use the plugin with very complex project setups and never encountered such an error.

For the deploy function it is intended that it is named manually deployed, because this kind of deployment should only be used for debug reasons and the deployed functions are completely out of control of CF (this behavior is due to SLS's handling - which should be changed there). As a consequence, the manually deployed function versions will not be deleted and you can see with the description that it should be deleted manually and is not tracked by CF.

I think that you're right that the problem has something to do with the descriptions - but I think the root cause is, that SLS changes the FUNCTION description and the version, which somehow interferes with the version generation, so that the original TransactionDashapiLambdaVersionwpEeyV9wDnRLKYRD3XkwKYtOdI8WBZjxYEFe9pQ2eCw is not a version anymore.

Can you please post your serverless.yml if possible - or even better, provide me with a simple sample project where I can reproduce the issue?

HyperBrain avatar Sep 30 '17 10:09 HyperBrain

Hi @HyperBrain

Thanks for your quick response.

I have forked your example project and can reproduce the error easily.

https://github.com/lintaonz/serverless-aws-alias-example

Here is the steps:

  1. export DEPLOY_TAG=build-100
  2. node ./node_modules/serverless/bin/serverless deploy --alias dev (work)
  3. export DEPLOY_TAG=build-101
  4. node ./node_modules/serverless/bin/serverless deploy --alias uat (work)
  5. export DEPLOY_TAG=build-102
  6. node ./node_modules/serverless/bin/serverless deploy --alias uat (fail)

Thanks,

lintaonz avatar Sep 30 '17 20:09 lintaonz

Hi @lintaonz, thanks for the reproduction steps. I will check it and try to figure out what exactly happens there.

HyperBrain avatar Oct 02 '17 09:10 HyperBrain