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: incorrect timestamps 1985 #2010

Closed
TerryHighfield opened this issue May 28, 2020 · 3 comments
Closed

sam build: incorrect timestamps 1985 #2010

TerryHighfield opened this issue May 28, 2020 · 3 comments

Comments

@TerryHighfield
Copy link

Description

'sam build' assigns incorrect timestamps to files. The original files have today's timestamp. I only have one folder to build (a serverless function). The source is written in typescript and built to dist. The dist folder content and the package.json file have the correct timestamp in the origin folder but have timestamp of 1985 under ./aws-sam/build.

'sam deploy' cannot deploy the package because of the incorrect timestamps.

Steps to reproduce

Provide steps to replicate.

run: sam build
run: find . -not -newerat "1990-12-31 23:59:59"

The last command shows any files with a timestamp before 1990. for me this lists the following files:
./.aws-sam/build/GetItoStaticDataFunction/dist/app.js.map
./.aws-sam/build/GetItoStaticDataFunction/dist/app.js
./.aws-sam/build/GetItoStaticDataFunction/package.json

Please provide command output with --debug flag set.

Expected result

Files should contain the same timestamp as the originals

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS
  2. sam --version: SAM CLI, version 0.52.0

build log:
buildLog.txt

@TerryHighfield
Copy link
Author

TerryHighfield commented May 28, 2020

Ok so this is an issue with npm pack. The file stamps are lost when simply using "npm pack" in the lambda function folder. The behavior is discussed here: npm/npm#19968. The change was intended (noMTime flag used with node-tar).

The problem I have is that 'sam deploy' gives the error: "ZIP does not support timestamps before 1980"

@TerryHighfield
Copy link
Author

Sorry, I'm running down the wrong path of diagnosis for my issue. The problem I have is calling the commands from python using the subprocess module. I've yet to figure out why.

Running sam build and sam deploy works fine when run directly from the command line.

Any help with python would be appreciated though! :)

@TerryHighfield
Copy link
Author

If anyone hits this issue I found the solution here: aws/aws-sdk-js#1977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant