Skip to content

sam build fail with "No such file or directory" for node build #1426

@Cubid

Description

@Cubid

Description

When building with
sam build --template sam-template.yaml
the build fail due to non existent temporary folder

Steps to reproduce

run sam build --template sam-template.yaml with js source in a scub package

Observed result

Running workflow 'NodejsNpmBuilder'
Running NodejsNpmBuilder:NpmPack
NODEJS packaging file:/authorizer to /tmp/tmpmn3v_qa7
executing NPM: ['npm', 'pack', '-q', 'file:/authorizer']
NODEJS packed to > backlinks-authorizer@1.0.0 prepare /authorizer

npm run build

backlinks-authorizer@1.0.0 build /authorizer
tsc --outDir build

backlinks-authorizer-1.0.0.tgz
NODEJS extracting to /tmp/tmpmn3v_qa7/unpacked
NodejsNpmBuilder:NpmPack raised unhandled exception
Traceback (most recent call last):
File "/home/xxx/.local/lib/python3.6/site-packages/aws_lambda_builders/workflow.py", line 248, in run
action.execute()
File "/home/xxx/.local/lib/python3.6/site-packages/aws_lambda_builders/workflows/nodejs_npm/actions.py", line 67, in execute
self.osutils.extract_tarfile(tarfile_path, self.artifacts_dir)
File "/home/xxx/.local/lib/python3.6/site-packages/aws_lambda_builders/workflows/nodejs_npm/utils.py", line 23, in extract_tarfile
with tarfile.open(tarfile_path, 'r:*') as tar:
File "/usr/lib/python3.6/tarfile.py", line 1571, in open
return func(name, "r", fileobj, **kwargs)
File "/usr/lib/python3.6/tarfile.py", line 1636, in gzopen
fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj)
File "/usr/lib/python3.6/gzip.py", line 163, in init
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmn3v_qa7/> backlinks-authorizer@1.0.0 prepare /authorizer\n> npm run build\n\n\n> backlinks-authorizer@1.0.0 build //authorizer\n> tsc --outDir build\n\nbacklinks-authorizer-1.0.0.tgz'

Build Failed

Expected result

The temp directory (and sub dirs) should be created for the script to continue

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

  1. OS: Ubuntu 18.04.3
  2. sam --version: SAM CLI, version 0.22.0

Add --debug flag to command you are running

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions