Search code examples
aws-lambdacontainersaws-cdkaws-pipeline

Resource handler returned message: "Invalid request provided: Updating PackageType is not supported"


I received the following error from Cloud Formation for AWS Lambda.

Resource handler returned message: "Invalid request provided: Updating PackageType is not supported" 

There was a Lambda stack successfully deployed; however, using CDK & pipelines, I attempted a git commit/push where instead of a 'vanilla' Lambda deployment, I pursued a containerized Lambda deployment (where the vanilla had previously successfully provisoned resources.)

Am I to interpret this error as that the Stack must be manually deleted/destroyed before these changes can be shipped?


Solution

  • I had a similar issue when my stack previously had a JS function and replaced it with a custom container image running a Python app.

    The reason why it happens is described in detail here: https://github.com/serverless/serverless/discussions/10805

    In short, it's a limitation of AWS - once you deployed a function with one PackageType, you can't just replace it with something with a different PackageType.

    What helped in my case: I just commented out the section with this specific function entry in my serverless.yml and redeployed - this removes just the function I need to update. Then I uncommented the definition, deploying again, this time using a custom container.