-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amplify push deployed an older version of package in lambda layer #12916
Comments
Hey @hisham 👋 thanks for raising this! We've had a few reports of this in the past but they were not reproducible. I will try to reproduce this using a combination of CLI and Hosting, but just to clarify when you mention
Are you referring to pushing to git and allowing Amplify Hosting to build for you? Are you running |
Yes that's correct. And I am not running amplify pull on my local machine after the build succeeds. |
Hey @hisham I am definitely noticing some odd behavior. First, I was able to push twice with the CLI: first with an empty package.json and second with just After adding another dependency and pushing with the CLI we now see version 5 alongside 4 (the one created by Hosting) However when I download the latest zip of the layer through the AWS Lambda Console I see it only has the two dependencies, not the new, third dep I was able to reproduce this using the provided reproduction steps, thank you for including those! Marking as a bug |
Awesome thanks @josefaidt :). I believe this should be treated as a high priority bug. Pushing old code caused an outage in some of our systems + bad data in our database that had to be fixed up. Fortunately we caught it early and an AWS Amplify Console build was already underway immediately after the bad push happened. |
I don't know if this is of any use but I did notice that a hard reference to the layer being used was inserted into the lambda CF template that used the layer in the file
|
might be related to #9386 |
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
18
Amplify CLI Version
12.0.3
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
no
Describe the bug
We typically deploy to our prod backend environment through Amplify Console CD.
However, in this scenario I did an amplify push to our prod env on my local machine. I don't do this often, but gitlab was down so I did deployment from my machine. My machine has the latest code from git - the same code Amplify Console would have pulled.
What happened is a new lambda layer was made, however the lambda layer had an older version of a package we reference in the layer's package.json (e.g. v6.10.3). This is despite the actual local package.json (and the one in git referring to a newer version (v7).
This obviously caused an outage in our system because we have functionality that relies on the newer package version (v7) that is not in the old one.
What I think happened is the lambda layer created used the last package version I used when I last deployed to prod in my local machine. Again, I don't push to prod often via my local machine, so the last package pushed via my local machine was old. But I don't understand why it would do that when at the time of this latest push, my layer's package.json did refer to the new version of the package to be included.
Am I supposed to do an amplify pull before amplify push when pushing to an env I have not pushed to in a while (but other people / amplify console pushes to frequently?).
The interesting thing is the layer did not appear as needing any change yet amplify did create a new layer (or made our lambdas reference an older layer version, I'm not 100% sure):
Another thing is we recently updated our Lambdas to Node 18, but perhaps the prod amplify push referenced an old lambda cloudformations with Node 16, so perhaps it used our last layer that was compatible with Node 16? Not sure.
Expected behavior
amplify push should use latest code on machine to deploy and not use code from last deployment.
Reproduction steps
I believe the repro steps would be:
5.. amplify push via Amplify Console
In step 6, the push will create a layer referencing the package.json in step 2, not step 4
Project Identifier
9aa765f6154c6bafb93f14988a5c3497
Log output
full log of the problematic deployment
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: