aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.83k stars 822 forks source link

Lambda layer wont update #10371

Open ykethan opened 2 years ago

ykethan commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

8.1.0

What operating system are you using?

Windows

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Amplify Categories

function

Amplify Commands

add, update

Describe the bug

Any changes to the Lambda layer are not being recognized. According to https://docs.amplify.aws/cli/function/layers/#lambda-layer-versions and https://docs.amplify.aws/cli/function/layers/#update-layer-content on modifying a lambda layer changes will be detected and a new version will be created but the CLI currently does not recognize the changes.

methods tried:

  1. modified the package.json with a new dependency
  2. installed node modules using npm.
  3. performed amplify update function for both function and layer.
  4. performed amplify env checkout to trigger a new layer version.

Expected behavior

CLI should be able to recognize layer changes and create a new version.

Reproduction steps

  1. amplify add function
  2. select layer
  3. amplify add function
  4. add layer to function
  5. amplify push

GraphQL schema(s)

```graphql # Put schemas below this line ```

Log output

``` # Put your logs below this line ```

Additional information

No response

CSHaze commented 2 years ago

I am seeing this as well. I can't figure out a way to get the layer to update.

jhockett commented 2 years ago

@CSHaze what OS are you using? I have not been able to reproduce on macOS.

CSHaze commented 2 years ago

@jhockett I am using windows 10. I was ultimately able to get it to update using amplify push —force

igo211 commented 1 year ago

FWIW, I'm also seeing this bug in amplify-cli version 10.8.1 (yes, running on windows 10).
The above mentioned workaround (amplify push --force) doesn't work for this case in 10.8.1: The amplify-cli generated cloudformation template for the new version of the Layer sets the description field to null, which causes the update to fail (no, the cli doesn't prompt for the version's description when it's a forced push).

Is this getting assigned and fixed anytime soon?

Tran-Minh23 commented 1 year ago

Jeez, I'm facing the same issue, I change the code inside the layer folder but the push command does not recognize the changes

0618 commented 1 year ago

Might be related to https://github.com/aws-amplify/amplify-cli/issues/9386