Skip to content
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

Corrupted zip archive produced #10234

Closed
5 tasks done
n3b opened this issue Apr 18, 2022 · 9 comments
Closed
5 tasks done

Corrupted zip archive produced #10234

n3b opened this issue Apr 18, 2022 · 9 comments
Labels
functions Issues tied to the functions category not-reproducible Not able to reproduce the issue

Comments

@n3b
Copy link

n3b commented Apr 18, 2022

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm install -g @aws-amplify/cli

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

16.14.2

Amplify CLI Version

8.0.1

What operating system are you using?

MacOS

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

nope

Amplify Categories

function, api

Amplify Commands

push

Describe the bug

After very fresh repository init and the amplify pull I have added a comment to function then tried to push by amplify push. I was forced to do a migration and after that I see this:

Screenshot 2022-04-18 at 01 24 21

I found similar reports at aws/aws-cdk#12536, however nothing of mentioned there helped to resolve my particular issue. If you could provide some info about what do I need to run amplify-cli from sources - that would be very useful.

Expected behavior

proper amplify push

Reproduction steps

  1. amplify pull
  2. change function
  3. amplify push

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line


Additional information

No response

@josefaidt
Copy link
Contributor

Hey @n3b 👋 thanks for raising this! To clarify, was a change made to a Lambda function that is attached to a Lambda Layer? I see from the screenshot it appears our layer version is erroring out. I also have a few follow-up questions:

  • what resource were you prompted to migrate?
  • were there any changes made to the Lambda or Layer outside of Amplify CLI (i.e. in the AWS Console)?
  • does amplify function push mitigate the issue?

@josefaidt josefaidt added functions Issues tied to the functions category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage labels Apr 18, 2022
@n3b
Copy link
Author

n3b commented Apr 18, 2022

Hey @josefaidt thanks for helping!
The function I changed is not attached to the layer. I did change that layer itself (I had to mention it, sorry) by removing the deprecated layerVersion from parameters.json. Additionally amplify-cli does some changes too - there is a prompt "Accept the suggested layer version configurations".

  • The lambda layer itself. "Amplify has updated the way Lambda Layer versions are managed. In order to take advantage of the newest features and bug fixes, a one-way migration is required....."
  • No, the layer contains node_modules only. The function wasn't modified via console too as far as I know.
  • it doesn't, same issue.

@josefaidt
Copy link
Contributor

Hey @n3b thanks for the clarification!

No, the layer contains node_modules only.

To further clarify, does the layer also contain the package.json and associated lockfile?

@n3b
Copy link
Author

n3b commented Apr 18, 2022

@josefaidt yes, those are there. The modules are installed locally too, not sure whether they are ignored or not.
I've checked multiple Node versions from 12 to 16 - the issue is consistent and doesn't depend on that.

@n3b n3b changed the title Corrupt zip archive produced Corrupted zip archive produced Apr 18, 2022
@josefaidt
Copy link
Contributor

Hey @n3b can you check to see whether the lambda layer distribution zip is empty? Are you able to cd into that directory and install dependencies without error?

@n3b
Copy link
Author

n3b commented Apr 19, 2022

hey @josefaidt yes it is empty 22b zip file, and yes I can install dependencies:

"dependencies": {
    "axios": "^0.21.1",
    "cross-fetch": "^3.0.6",
    "graphql-tag": "^2.11.0",
    "mysql": "^2.18.1"
  }

@josefaidt
Copy link
Contributor

Hey @n3b thank you for clarifying! Unfortunately I am unable to reproduce this issue using a sample lambda layer with a few dependencies as I can see my distribution zip archive is around 40MB. Would you mind sending your amplify/ directory as a zip archive to amplify-cli@amazon.com? I'd like to take a further look at the setup

@n3b
Copy link
Author

n3b commented Apr 21, 2022

Hey @josefaidt unfortunately I can't do that due to privacy. We've found a quick workaround by getting rid of the layer completely.

@josefaidt josefaidt removed the pending-response Issue is pending response from the issue author label Apr 26, 2022
@josefaidt
Copy link
Contributor

Hey @n3b I have revisited this issue with another layer and the only way I'm able to reproduce this issue is if I delete all files in the layer's lib/nodejs/ directory and opt/ and push. Since the layer has been removed entirely and I am unable to reproduce I will close this issue for now. In the event you choose to use a Lambda Layer and this issue arises, please reply back to this thread with minimal reproduction steps and we can re-open to investigate further 🙂

@josefaidt josefaidt added not-reproducible Not able to reproduce the issue and removed pending-triage Issue is pending triage labels Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Issues tied to the functions category not-reproducible Not able to reproduce the issue
Projects
None yet
Development

No branches or pull requests

2 participants