cloudformation-cli icon indicating copy to clipboard operation
cloudformation-cli copied to clipboard

Caught Downstream Error with `cfn submit`

Open tjbrockmeyer opened this issue 3 years ago • 0 comments

OS: Windows 10 Pro 64-bit

I am trying to cfn submit to register a resource type that I've developed, but I am receiving some errors.

This is the output of running cfn submit:

Resource schema is valid.
Starting build.
=== Caught downstream error ===
[WinError 2] The system cannot find the file specified
---
If debugging indicates this is a possible error with this program,
please report the issue to the team and include the log file 'rpdk.log'.
Issue tracker: https://github.com/aws-cloudformation/aws-cloudformation-rpdk/issues

Inspecting the logs, it appears that the issue is resulting from the command it uses to start the build: npm install --optional && sam build --debug --build-dir C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring/build --use-container TypeFunction

But if I run that command in isolation, it builds the function in the ./build directory with no issues.

Here is the full log output:

[2022-04-11T02:58:30Z] DEBUG    - Logging set up successfully
[2022-04-11T02:58:30Z] DEBUG    - Running submit: Namespace(version=False, subparser_name='submit', command=<function submit at 0x000001FAA5EE7940>, verbose=0, dry_run=False, endpoint_url=None, region=None, set_default=False, role_arn=None, use_role=True)
[2022-04-11T02:58:30Z] DEBUG    - Root directory: C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring
[2022-04-11T02:58:30Z] DEBUG    - Loading project file 'C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring\.rpdk-config'
[2022-04-11T02:58:30Z] INFO     - Validating your resource specification...
[2022-04-11T02:58:30Z] DEBUG    - Rewriting refs in '<BASE>' (file:///C:/Coding/code/web/infra/aws/custom-resources/tjb-ssm-securestring/tjb-ssm-securestring.json)
[2022-04-11T02:58:30Z] WARNING  - Resource schema is valid.
[2022-04-11T02:58:30Z] INFO     - Validating your resource schema...
[2022-04-11T02:58:30Z] DEBUG    - inputs not found. Not writing to package.
[2022-04-11T02:58:30Z] DEBUG    - Package started
[2022-04-11T02:58:30Z] DEBUG    - 'C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring\build' not found, skipping removal
Traceback (most recent call last):
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\typescript\codegen.py", line 215, in _remove_build_artifacts
    shutil.rmtree(deps_path)
  File "c:\coding\frameworks\python\python3.9.1\lib\shutil.py", line 740, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\coding\frameworks\python\python3.9.1\lib\shutil.py", line 599, in _rmtree_unsafe
    onerror(os.scandir, path, sys.exc_info())
  File "c:\coding\frameworks\python\python3.9.1\lib\shutil.py", line 596, in _rmtree_unsafe
    with os.scandir(path) as scandir_it:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Coding\\code\\web\\infra\\aws\\custom-resources\\tjb-ssm-securestring\\build'
[2022-04-11T02:58:30Z] DEBUG    - Dependencies build started from 'C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring'
[2022-04-11T02:58:30Z] DEBUG    - command is 'npm install --optional && sam build --debug --build-dir C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring/build --use-container TypeFunction'
[2022-04-11T02:58:30Z] WARNING  - Starting build.
[2022-04-11T02:58:30Z] DEBUG    - Caught downstream error
Traceback (most recent call last):
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\typescript\codegen.py", line 243, in _build
    completed_proc = subprocess_run(  # nosec
  File "c:\coding\frameworks\python\python3.9.1\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "c:\coding\frameworks\python\python3.9.1\lib\subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "c:\coding\frameworks\python\python3.9.1\lib\subprocess.py", line 1416, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\cli.py", line 100, in main
    args.command(args)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\submit.py", line 15, in submit
    project.submit(
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\project.py", line 650, in submit
    self._add_resources_content_to_zip(zip_file)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\project.py", line 678, in _add_resources_content_to_zip
    self._plugin.package(self, zip_file)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\typescript\codegen.py", line 204, in package
    self._build(project.root)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\typescript\codegen.py", line 251, in _build
    raise DownstreamError("local build failed") from e
rpdk.core.exceptions.DownstreamError: local build failed

tjbrockmeyer avatar Apr 11 '22 03:04 tjbrockmeyer