"Error: Unable to upload artifact referenced by Location parameter of resource. 'S3Uploader' object is not subscriptable."

While working on a multi-stack AWS SAM package I came across this rather obscure error:

Error: Unable to upload artifact ../../spa-hosting.yaml referenced by Location parameter of Hosting resource. ‘S3Uploader’ object is not subscriptable

After an embarrassing amount of troubleshooting, the culprit turns out to be the Metadata[AWS::ServerlessRepo::Application] element in the nested stack.

The nested stack is also published to the Serverless Application Repository, but I copied the template into this project for some additional customizations. As soon as I removed that element, the stack deployed correctly.

1
2
3
4
5
6
7
8
# template.yaml

Hosting:
Type: AWS::Serverless::Application
Properties:
Location: ../../spa-hosting.yaml
Parameters:
BucketName: !Ref AWS::StackName
1
2
3
4
5
6
7
8
9
10
# spa-hosting.yaml

Metadata:
AWS::ServerlessRepo::Application:
Name: spa-hosting
Description: Creates the AWS infrastructure for running a Single Page App in AWS using S3 & CloudFront
Author: Ivan Bliskavka
ReadmeUrl: README.md
HomePageUrl: https://bliskavka.com
SemanticVersion: 1.0.0

I hope this saves somebody some headaches!

-Ivan

Share