Skip to content

Cannot Zip project when babel is installed: ZIP does not support timestamps before 1980 #12125

Description

@maratsh

Bug Report

  • I would like to work on a fix!

Current behavior
I'm using aws sam to deploy lambdas with babel.

I have babel in dependencies

  "dependencies": {
    "@babel/runtime": "^7.9.2",
}

I'm running

npm install
npm run build 
sam build
sam deploy

process breaks on sam deploy with error

the only project with date older than 1980 I could find is babel

find -not -newermt 'jan 01, 1980'

node_modules/@babel/parser/CHANGELOG.md
node_modules/@babel/parser/LICENSE
node_modules/@babel/parser/README.md
node_modules/@babel/parser/bin/babel-parser.js
node_modules/@babel/parser/lib/index.js
node_modules/@babel/parser/lib/index.js.map
node_modules/@babel/parser/typings/babel-parser.d.ts
node_modules/@babel/types/LICENSE
node_modules/@babel/types/README.md
node_modules/@babel/types/lib/asserts/assertNode.js
node_modules/@babel/types/lib/asserts/generated/index.js
node_modules/@babel/types/lib/builders/builder.js
node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTyp
node_modules/@babel/types/lib/builders/generated/index.js
node_modules/@babel/types/lib/builders/react/buildChildren.js
node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
node_modules/@babel/types/lib/clone/clone.js
node_modules/@babel/types/lib/clone/cloneDeep.js
node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
node_modules/@babel/types/lib/clone/cloneNode.js
node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
node_modules/@babel/types/lib/comments/addComment.js
node_modules/@babel/types/lib/comments/addComments.js
node_modules/@babel/types/lib/comments/inheritInnerComments.js
node_modules/@babel/types/lib/comments/inheritLeadingComments.js
node_modules/@babel/types/lib/comments/inheritTrailingComments.js
node_modules/@babel/types/lib/comments/inheritsComments.js
node_modules/@babel/types/lib/comments/removeComments.js
node_modules/@babel/types/lib/constants/generated/index.js
node_modules/@babel/types/lib/constants/index.js
node_modules/@babel/types/lib/converters/ensureBlock.js
node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
node_modules/@babel/types/lib/converters/toBlock.js
node_modules/@babel/types/lib/converters/toComputedKey.js
node_modules/@babel/types/lib/converters/toExpression.js
node_modules/@babel/types/lib/converters/toIdentifier.js
node_modules/@babel/types/lib/converters/toKeyAlias.js
node_modules/@babel/types/lib/converters/toSequenceExpression.js
node_modules/@babel/types/lib/converters/toStatement.js
node_modules/@babel/types/lib/converters/valueToNode.js
node_modules/@babel/types/lib/definitions/core.js
node_modules/@babel/types/lib/definitions/experimental.js
node_modules/@babel/types/lib/definitions/flow.js
node_modules/@babel/types/lib/definitions/index.js
node_modules/@babel/types/lib/definitions/jsx.js
node_modules/@babel/types/lib/definitions/misc.js
node_modules/@babel/types/lib/definitions/placeholders.js
node_modules/@babel/types/lib/definitions/typescript.js
node_modules/@babel/types/lib/definitions/utils.js
node_modules/@babel/types/lib/index.d.ts
node_modules/@babel/types/lib/index.js
node_modules/@babel/types/lib/index.js.flow
node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
node_modules/@babel/types/lib/modifications/inherits.js
node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
node_modules/@babel/types/lib/modifications/removeProperties.js
node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicate
node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
node_modules/@babel/types/lib/traverse/traverse.js
node_modules/@babel/types/lib/traverse/traverseFast.js
node_modules/@babel/types/lib/utils/inherit.js
node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
node_modules/@babel/types/lib/utils/shallowEqual.js
node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
node_modules/@babel/types/lib/validators/generated/index.js
node_modules/@babel/types/lib/validators/is.js
node_modules/@babel/types/lib/validators/isBinding.js
node_modules/@babel/types/lib/validators/isBlockScoped.js
node_modules/@babel/types/lib/validators/isImmutable.js
node_modules/@babel/types/lib/validators/isLet.js
node_modules/@babel/types/lib/validators/isNode.js
node_modules/@babel/types/lib/validators/isNodesEquivalent.js
node_modules/@babel/types/lib/validators/isPlaceholderType.js
node_modules/@babel/types/lib/validators/isReferenced.js
node_modules/@babel/types/lib/validators/isScope.js
node_modules/@babel/types/lib/validators/isSpecifierDefault.js
node_modules/@babel/types/lib/validators/isType.js
node_modules/@babel/types/lib/validators/isValidES3Identifier.js
node_modules/@babel/types/lib/validators/isValidIdentifier.js
node_modules/@babel/types/lib/validators/isVar.js
node_modules/@babel/types/lib/validators/matchesPattern.js
node_modules/@babel/types/lib/validators/react/isCompatTag.js
node_modules/@babel/types/lib/validators/react/isReactComponent.js
node_modules/@babel/types/lib/validators/validate.js
node_modules/@babel/types/scripts/generateTypeHelpers.js
node_modules/@babel/types/scripts/generators/docs.js
node_modules/@babel/types/scripts/generators/flow.js
node_modules/@babel/types/scripts/generators/generateAsserts.js
node_modules/@babel/types/scripts/generators/generateBuilders.js
node_modules/@babel/types/scripts/generators/generateConstants.js
node_modules/@babel/types/scripts/generators/generateValidators.js
node_modules/@babel/types/scripts/generators/typescript.js
node_modules/@babel/types/scripts/utils/formatBuilderName.js
node_modules/@babel/types/scripts/utils/lowerFirst.js
node_modules/@babel/types/scripts/utils/stringifyValidator.js
node_modules/@babel/types/scripts/utils/toFunctionName.js

Possible Solution

moving file timestamp in tarball in npm to more safe 1980+
I know that npm locks dates for tarballed files, but usually date is in 1985 which is supported by zip.

Additional context
this causes problems in many lambdas and really annoying. there are simple workaround, but this potentially breaks caching.
I'm not sure if babel project is right place, but It will be awesome if you could fix this (moving file date to more safe 1980+) or point in which project this behavior is maintained

Activity

  1. babel-bot commented on Sep 30, 2020

    @babel-bot
    Collaborator

    Hey @maratsh! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

    If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

  2. nicolo-ribaudo commented on Sep 30, 2020

    @nicolo-ribaudo
    Member

    This will be fixed by releasing a new Babel version after a new yarn version is released: yarnpkg/berry#1882

  3. arcanis commented on Sep 30, 2020

    @arcanis
    Contributor

    We're planning to make the release by the end of the week, will ping here once it's published (or you can use yarn set version from sources to use master, which is very close from what will be shipped).

  4. nicolo-ribaudo commented on Sep 30, 2020

    @nicolo-ribaudo
    Member

    @maratsh Until we release a new version, you can use this workaround (nicolo-ribaudo/babel-preset-current-node-syntax#6 (comment)):

    find ./node_modules/@babel/ -mtime +10950 -print -exec touch {} \;
    
  5. maratsh commented on Oct 1, 2020

    @maratsh
    Author

    Thank you. Yes, we already do.

  6. arcanis commented on Oct 2, 2020

    @arcanis
    Contributor

    We've just released Yarn 2.3, which should address this problem!

  7. nicolo-ribaudo commented on Oct 2, 2020

    @nicolo-ribaudo
    Member

    Thanks! I'm preparing a PR to update it here.

  8. afittz commented on Oct 14, 2020

    @afittz

    @nicolo-ribaudo Looks like the same issue is happening on the npm package version 7.12.0.

  9. JLHwung commented on Oct 14, 2020

    @JLHwung
    Contributor

    @afittz I can not reproduce this on @babel/[email protected]

    Can you attach the output of

    npm install @babel/runtime
    stat node_modules/@babel/runtime/LICENSE
    
  10. nicolo-ribaudo commented on Oct 14, 2020

    @nicolo-ribaudo
    Member

    Or even better, the output of find -not -newermt 'jan 01, 1980'

  11. afittz commented on Oct 14, 2020

    @afittz

    I'm on Windows, so I think this is the equivalent.

    I don't get the issue when I run
    npm install @babel/[email protected] -E

    When I install latest I see the issue.
    npm install @babel/runtime@latest

    File stamps as requested:
    Untitled

  12. nicolo-ribaudo commented on Oct 14, 2020

    @nicolo-ribaudo
    Member

    Does node_modules/@babel/runtime/package.json say that it's 7.12.0?

  13. afittz commented on Oct 14, 2020

    @afittz

    I should also note that every file in the extracted package (node_modules/@babel/runtime), save for package.json, has the 1979 modified date. It appears to be the same list as the originally reported issue.

    The comment above came in as I was typing the above. Yes, the package.json file shows 7.12.0:

    {
    "_from": "@babel/runtime@latest",
    "_id": "@babel/[email protected]",
    ...,
    "_resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.0.tgz",
    ...
    }

  14. nicolo-ribaudo commented on Oct 14, 2020

    @nicolo-ribaudo
    Member

    I can reproduce it

  15. afittz commented on Oct 14, 2020

    @afittz

    If it helps, I downloaded the package and 7-Zip also shows the same dates.

  16. nicolo-ribaudo commented on Oct 14, 2020

    @nicolo-ribaudo
    Member

    I did some investigation.

    The original issue is that ZIP doesn't support dates older than January 1st, 1980, 0:00:00. For this reason, yarn sets "January 1st, 1980, 0:00:00 UTC" as the file modified date.
    However, I believe that you are in the UTC-6 timezone (or similar), and thus see it as December 31st, 1979.

    Zips store the local date and not the UTC one (source, search for local time): for this reason, it's still failing for you.

    @arcanis In order to fix this bug, I think that yarn should add 1 days to that date, so that it works in every timezone.

  17. arcanis commented on Oct 14, 2020

    @arcanis
    Contributor

    We'll do that change, but it seems to highlight a problem in the zip packer that people use - it means that the generated zip will have different checksum depending on the timezone for the server that generates the archive 😕

  18. nicolo-ribaudo commented on Oct 14, 2020

    @nicolo-ribaudo
    Member

    @arcanis My feelings for zip went from "neutral" to "make it disappear" in the last 30 mins 🙃

  19. JLHwung commented on Oct 14, 2020

    @JLHwung
    Contributor

    I have added a todo list about 7.12.1 publish: Essentially we should republish every affected packages: babel/notes#78 (comment).

  20. nicolo-ribaudo commented on Oct 15, 2020

    @nicolo-ribaudo
    Member

    This should be fixed in 7.12.1 (just released)

  21. ThisIsWebGoat commented on Oct 19, 2020

    @ThisIsWebGoat

    Tested deployment of latest version using AWS CodeBuild / CodePipeline and can confirm it's working now! Thanks!

  22. added
    outdated
    on Jan 19, 2021
  23. locked as resolved and limited conversation to collaborators on Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: upstreamoutdated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions