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

sam build error - npm ERR! code Z_DATA_ERROR npm ERR! errno -3 npm ERR! zlib: invalid distance too far back #6530

Closed
tushae01 opened this issue Jan 5, 2024 · 3 comments
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@tushae01
Copy link

tushae01 commented Jan 5, 2024

Hello,
We're moving to a new Jenkins and our sam builds are failing with the following error -
npm ERR! code Z_DATA_ERROR npm ERR! errno -3 npm ERR! zlib: invalid distance too far back
I can get past this error with sam build -u from the command prompt, but when I use sam build -u in the jenkins pipeline build step "-u" is ignored and I still get the error.
It looks like using sam build -u in a jenkins pipeline is a known issue (#3965).
Could you point toward some ideas for getting past the npm error?

During one attempt, I used the old instance's nodejs version on a new instance, but there were openssl and libuv conflicts. Instead I continue to use the nodejs version available for Alma.

Details on new instance -
ec2
Alma 9.3
SAM CLI, version 1.105.0
Python 3.9.18
npm: '8.19.4',
node: '16.20.2',
uv: '1.43.0',
zlib: '1.2.11',
openssl: '3.0.7'

The instance being replaced details (where we don't encounter the npm error)
ec2
centOS7
default python - Python 2.7.5
additional python versions in PATH - 3.7.16, 3.8.6_2, 3.9.16
sam version 1.67.0
npm: '8.19.2',
node: '16.18.1',
uv: '1.44.1',
zlib: '1.2.11',
openssl: '1.1.1k',

from the job's log -
Building codeuri: ...../workspace/..../src runtime: nodejs16.x metadata: {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': False, 'EntryPoints': ['app.ts']}} architecture: x86_64 functions: TimeDataFunction
Running NodejsNpmEsbuildBuilder:CopySource
Running NodejsNpmEsbuildBuilder:NpmInstall

Build Failed
Error: NodejsNpmEsbuildBuilder:NpmInstall - NPM Failed: npm WARN config production Use --omit=dev instead.
npm WARN tar zlib: invalid distance too far back
npm WARN tarball cached data for uuid@https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz (sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==) seems to be corrupted. Refreshing cache.
npm WARN tar zlib: invalid distance too far back
npm WARN tarball cached data for strnum@https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz (sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==) seems to be corrupted. Refreshing cache.
.....
npm WARN tarball cached data for tslib@https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz (sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==) seems to be corrupted. Refreshing cache.
npm WARN tarball tarball data for strnum@https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz (sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==) seems to be corrupted. Trying again.
npm WARN tar zlib: invalid distance too far back
npm WARN tarball tarball data for @aws-sdk/eventstream-serde-universal@https://registry.npmjs.org/@aws-sdk/eventstream-serde-universal/-/eventstream-serde-universal-3.226.0.tgz (sha512-Q8viYM1Sv90/yIUqyWNeG1GEvyVlAI3GIrInQcCMC+xT59jS+IKGy2y7ojCvSWXnhf5/HMXKcmG092QsqeKy0Q==) seems to be corrupted. Trying again.
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! zlib: invalid distance too far back
......
npm ERR! A complete log of this run can be found in:
npm ERR! ...../.npm/_logs2024-01-05T13_56_33_505Z-debug-0.log

added the log -
keep_2024-01-05T13_56_33_505Z-debug-0.log

Thank you!

@tushae01 tushae01 added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Jan 5, 2024
@mildaniel
Copy link
Contributor

From the links provided in this comment, this seems likely to be related to system dependency issues and not SAM CLI itself. If you run npm commands on that machine outside of sam build, do those work?

@mildaniel mildaniel added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jan 5, 2024
@tushae01
Copy link
Author

tushae01 commented Jan 5, 2024

Thanks @mildaniel , I'm not familiar with npm troubleshooting, but I tried a recommendation I found and it works from jenkins home, but not the job workspace - "npm install --timing". Thank you for responding, I will continue to research my npm installation (I used dnf rather than nvm).

@tushae01 tushae01 closed this as completed Jan 5, 2024
Copy link
Contributor

github-actions bot commented Jan 5, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

2 participants