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

Generated template.yml references incorrect CodeUri #1043

Open
corey-cole opened this issue Nov 14, 2023 · 0 comments
Open

Generated template.yml references incorrect CodeUri #1043

corey-cole opened this issue Nov 14, 2023 · 0 comments

Comments

@corey-cole
Copy link

The initial template.yml generated at the root of the project has CodeUri: build/. Executing sam build results in a no-op obscured by a stack trace:

Skipping copy operation since source <my working directory>/alb-perimeter-hook/build does not exist

Error: [Errno 2] No such file or directory: '<my working directory>/alb-perimeter-hook/.aws-sam/build/TypeFunction'
Traceback:
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/cli/cli_config_file.py", line 347, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/telemetry/metric.py", line 184, in wrapped
    raise exception  # pylint: disable=raising-bad-type
    ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/telemetry/metric.py", line 149, in wrapped
    return_value = func(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/utils/version_checker.py", line 42, in wrapped
    actual_result = func(*args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/cli/main.py", line 95, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/commands/build/command.py", line 171, in cli
    do_cli(
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/commands/build/command.py", line 260, in do_cli
    ctx.run()
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/commands/build/build_context.py", line 281, in run
    self._build_result = builder.build()
                         ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/build/app_builder.py", line 218, in build
    return ApplicationBuildResult(build_graph, build_strategy.build())
                                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/build/build_strategy.py", line 81, in build
    result.update(self._build_functions(self._build_graph))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/build/build_strategy.py", line 91, in _build_functions
    function_build_results.update(self.build_single_function_definition(build_definition))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/build/build_strategy.py", line 195, in build_single_function_definition
    osutils.copytree(single_build_dir, artifacts_dir)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.101.0/libexec/lib/python3.12/site-packages/samcli/lib/utils/osutils.py", line 164, in copytree
    names = os.listdir(source)
            ^^^^^^^^^^^^^^^^^^

Updating the generated template to CodeUri: src/ results in a working build result with no stack trace. The documentation doesn't explain how a build directory is/might be created, and none of the steps executed in the initial README result in a build directory.

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