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

Code Deploy - Unhandled exception - ZIP does not support timestamps before 1980 #2639

Closed
jwarykowski opened this issue Jun 5, 2017 · 32 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.

Comments

@jwarykowski
Copy link

Overview

When running a deployment via circle-ci we've recently been getting the following error when running the create_application_revision command:

Unhandled exception
ZIP does not support timestamps before 1980

I couldn't find an existing issue with the repo. We haven't changed any configuration recently. This appears to have only started happening since yesterday, it was the first time we had the error on our builds.

We're running the following versions:

aws-cli/1.11.97 Python/2.7.6 Linux/3.13.0-48-generic botocore/1.5.60

If anyone is able to point us in the right direction that would be greatly appreciated.

@mgibas
Copy link

mgibas commented Jun 5, 2017

Same error for:
aws cloudformation package ...

Uploading to a5902e46b3516ee3f44caf6251079b5f  1846 / 1846.0  (100.00%)
Unable to upload artifact ./../async-handlers/donation-created-handler referenced by CodeUri parameter of DonationCreatedHandlerFunction resource.
ZIP does not support timestamps before 1980

even after downgrading to 1.11.79 (that was working some time ago) gives the same error.

full build log

@JordonPhillips
Copy link
Member

It sounds like you have some files with invalid timestamps. This could be indicative of a larger issue, so I would recommend fixing them. Changing your version of the CLI won't impact this because the the error is raised in python itself.

@JordonPhillips JordonPhillips added closing-soon This issue will automatically close in 4 days unless further comments are made. question labels Jun 5, 2017
@arsenio
Copy link

arsenio commented Jun 5, 2017

I'm noticing the exact same error message with CircleCI today, during the create_application_revision command:


create_application_revision loaded: {"applications":[{"region":"us-west-2","application_root":"/","revision_location":{"s3Location":{"bucket":"<BUCKET>","key":"<BUCKET_KEY>"},"revisionType":"S3"},"deployment_group":"staging","application_name":"<appname>"}]}
Bundling <appname> from /home/ubuntu/<appname>
Unhandled exception
ZIP does not support timestamps before 1980

((create_application_revision "/tmp/codedeploy_applications.json" "/tmp/codedeploy_revisions.json")) returned exit code 1

@arsenio
Copy link

arsenio commented Jun 5, 2017

There's also a Bug Report open on CircleCI's support forums about this.

@jwarykowski
Copy link
Author

@JordonPhillips thanks for the quick feedback. We'll wait to see if anyone gets back to us on the CircleCi issue. @arsenio -just to note we deployed manually via code deploy directly and this solved the problem in the short term.

@mgibas
Copy link

mgibas commented Jun 6, 2017

So for me uglify-js got files with creation date at 1969.
As a workaround I added this:

find ./dist/ -type f -exec touch -t 201601011200 '{}' \;

@completer
Copy link

completer commented Jun 6, 2017

This is happening for us too; since Sunday on our Shippable build server and locally after a rm -rf node_modules

eb deploy
Creating application version archive "app-bce1-170606_163952".
ERROR: ValueError :: ZIP does not support timestamps before 1980

This is a nodejs app, EB CLI 3.9.0 (Python 2.7.1)

Update: Looks like this is being caused by uglify-js as @mgibas says.

@arsenio
Copy link

arsenio commented Jun 6, 2017

@mgibas with the save: certain (but not all) files in the ugllify-js library have 1969 timestamps on them. Touching those files should get your past this nasty hurdle.

@completer
Copy link

Actually seems to me to be a prob with Webpack's NPM package. Posted issue webpack/webpack#5022

@mgibas
Copy link

mgibas commented Jun 7, 2017

Yeah, seems like uglify is a pretty common dependency :)

mishoo/UglifyJS#2054

@et304383
Copy link

et304383 commented Jun 7, 2017

@sumothecat it's not Webpack's issue. It's an issue with UglifyJS which webpack uses. The community needs to point fingers in the correct location as has been linked by @mgibas

@completer
Copy link

@eric-tucker we don't use Uglify, but Webpack has an implicit dependency on it. I've closed the issue in Webpack and will be using a yarn lock file in future!

@felipekm
Copy link

felipekm commented Jun 8, 2017

Same here, any thoughts?

image

@brendanmh
Copy link

brendanmh commented Jun 8, 2017

For my application, both jest and webpack were bringing in the corrupted version of uglify-js.

As I already use npm-shrinkwrap, I added the following lines to my npm-shrinkwrap.json file -

"uglify-js": {
      "version": "2.8.27",
      "from": "uglify-js@=2.8.27",
      "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.27.tgz"
    },

which let me work around this issue temporarily.

@goodanthony
Copy link

Looking at mgibas answer, temp solution that worked for me for now after a yarn install or npm install is.

find node_modules/uglify-js -print -exec touch {} \;

@moshest
Copy link

moshest commented Jun 13, 2017

More robust hack to add to your package.json file:

{
  "scripts": {
    "install": "find ./node_modules/* -mtime +10950 -exec touch {} \\;"
  }
}

This will touch each file that is more then 30 years old after each npm install command.

@joguSD
Copy link
Contributor

joguSD commented Jul 24, 2017

Is anybody still having this issue?
The bug in NPM corrupting the mtime has since been fixed.
And a new version of UglifyJS has been published.

@seibar
Copy link

seibar commented Mar 18, 2018

Also appears to be an issue with the ieee754 module, which is a dependency of aws-sdk. This issue has been reported: feross/ieee754#17

seibar added a commit to seibar/place-puppy that referenced this issue Mar 18, 2018
@aheld
Copy link

aheld commented Mar 26, 2018

seeing the same issues, cause by @slack/client npm this time.

@cazzer
Copy link

cazzer commented Mar 27, 2018

Though there is definitely an issue with some timestamps getting mangled, I don't see why this CLI tool should care. What is the reason for invalid timestamps causing this issue? Is there a way they can be supported to entirely avoid this issue?

@KonstantinKolodnitsky
Copy link

I had the same issue. I tried everything, but only restarting my laptop did the trick.

@rus-yurchenko
Copy link

Same issue and it's not an uglify-js issue since I have a latest version of this lib.

@asifashraf
Copy link

as suggested above i just ran
find ./node_modules/* -mtime +10950 -exec touch {} ;
on vscode terminal from root dir of the proj and it fixed it

@vochicong
Copy link

eb deploy gave me

ERROR: ValueError - ZIP does not support timestamps before 1980

find . -mtime +10950 -print -exec touch {} \;
solved the problem.

@einnjo
Copy link

einnjo commented Jun 21, 2018

This has been a recurrent issue on multiple proyects with different dependencies.

@georgschlenkhoff
Copy link

I still run into this issue.

@matthoang08
Copy link

Just had this issue too when I added nyc (istanbul) as a dev dependency, it looks like it added uglify-js which is the root cause of this issue.

@cyrilhamidechi
Copy link

From my PoV, it seems related to yarn on Mac.
When using npm on Mac everything's fine.
When using yarn on Ubuntu everything's fine.
Even with uglify-js and many other dependencies.
It can be demoed by packaging the hello-world of AWS SAM (https://github.com/awslabs/aws-sam-cli/tree/develop#package-and-deploy-to-lambda).
Else, #2639 (comment) do perfectly the trick (but can be costly with many files)

@kpx-dev
Copy link

kpx-dev commented Aug 23, 2018

We use yarn --production that skip all the devDependencies packages, it helps solved this problem.

@cazzer
Copy link

cazzer commented Aug 27, 2018

Sadly, I depend on a few packages in production which cause this issue so yarn --production doesn't help.

That said, yarn --production before fixing timestamps in node_modules/ does significantly decrease build time.

@albertkimdev
Copy link

What is the windows command for

find ./node_modules/* -mtime +10950 -exec touch {} \;

I can't run this on my computer

@diehlaws diehlaws added guidance Question that needs advice or information. and removed question labels Jan 4, 2019
douglasnaphas added a commit to douglasnaphas/cdn01-dsns that referenced this issue Sep 21, 2020
CodeBuild was giving me an error like:

> [Container] 2020/09/21 18:50:44 Entering phase BUILD
> [Container] 2020/09/21 18:50:44 Running command aws cloudformation
> package --template template.yml --s3-bucket $S3_BUCKET --output-template \
> template-export.yml
> Unable to upload artifact None referenced by CodeUri parameter of
> HelloWorld resource.
> ZIP does not support timestamps before 1980

This implements [a
workaround](aws/aws-cli#2639 (comment)),
slightly adapted. The command

find node_modules/ -mtime +14600 -print

revealed that some files within node_modules/@babel and
node_modules/babel-preset-current-node-syntax were very old.
adjerbetian pushed a commit to adjerbetian/kata-molecular-parser that referenced this issue Sep 27, 2020
@eduardomourar
Copy link

It looks like this could have been fixed by using the strict_timestamps argument from zipfile python library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests