Error while packaging sam application

0

Hi,

I am trying to package and deploy my sam application which I have within a yaml template which also links to local paths for lambda functions, however when I try to package it or deploy it with the '--guided' parameter I get this error message:

Traceback (most recent call last):
  File "/opt/homebrew/bin/sam", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.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.110.0/libexec/lib/python3.12/site-packages/click/core.py", line 1686, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/click/core.py", line 943, in make_context
    self.parse_args(ctx, args)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/click/core.py", line 1408, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/click/core.py", line 2400, in handle_parse_result
    value = self.process_value(ctx, value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/click/core.py", line 2362, in process_value
    value = self.callback(ctx, self, value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/samcli/commands/_utils/options.py", line 195, in artifact_callback
    for _template_artifact in get_template_artifacts_format(template_file=template_file)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.110.0/libexec/lib/python3.12/site-packages/samcli/commands/_utils/template.py", line 304, in get_template_artifacts_format
    if resource.get("Type") in packageable_resources.keys():
       ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

I was getting the same error with package installer.

The command I am using: Package:

sam package \              
    --template-file template.yaml \
    --output-template-file packaged-template.yaml \
    --s3-bucket template-bucket

Deploy:

sam deploy \
    --template-file template.yaml \
    --stack-name example-name-Template \
    --capabilities CAPABILITY_IAM \
    --region us-east-1 \
    --guided \
    --s3-bucket template-bucket

I am not quite sure as to why I am getting this error, since it worked before but it I got an error while deploying, so I fixed the error and I am re-attempting to deploy now but I am having no success, I've re-installed and tried with both package installer and homebrew.

Thank you

1 Answer
1
Accepted Answer

Hi,

I managed to fix it, turns out there was a error within my yaml template, my template was quite big, so the error was quite hard to spot so I broke the template down into individual parts and deployed it that way.

NelioB
answered 2 months ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions