question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sam Package Requires S3 Bucket For PackageType: Image

See original GitHub issue

I can confirm that the --s3-bucket and --s3-prefix have no use during sam package when using the PackageType: Image process with the --image-repository option. However when I remove the S3 options, the command won’t run. Can we remove that if indeed that is an oversight?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
bjfletchercommented, Dec 30, 2020

It’s a bug in the aws-sam-cli code.

I’ve found that if template.yaml contains just AWS::Serverless::Function resources with PackageType: Image then it doesn’t complain asking for s3-bucket.

If however template.yaml contains non-function resources (e.g. AWS::Events::Rule) without PackageType: Image then it complains asking for s3-bucket. When I add PackageType: Image to these non-function resources, then it doesn’t complain asking for s3-bucket. (But sam deploy will then point out that these non-function resources shouldn’t have PackageType: Image.)

In short, aws-sam-cli code needs to be fixed to check PackageType only in the AWS::Serverless::Function resources.

2reactions
metaskillscommented, Dec 8, 2020

Yup, still seeing it. My sam package command is this.

sam package \
  --region "$AWS_DEFAULT_REGION" \
  --template-file ./.aws-sam/build/template.yaml \
  --output-template-file ./.aws-sam/build/packaged.yaml \
  --image-repository "$IMAGE_REPOSITORY"

And the error is this.

== SAM package...
Usage: sam package [OPTIONS]
Try 'sam package --help' for help.

Error: Missing option '--s3-bucket'

I’m using this cookiecutter. https://github.com/customink/lamby-cookiecutter/tree/master/{{cookiecutter.project_name}}

Read more comments on GitHub >

github_iconTop Results From Across the Web

sam package - AWS Serverless Application Model
To package an AWS SAM application, use the sam package command from the AWS SAM CLI. ... Required for functions declared with the...
Read more >
sam package - Amazon Serverless Application Model
To package an Amazon SAM application, use the sam package command from the Amazon SAM CLI. ... Required for functions declared with the...
Read more >
Deploying sam template of a lambda with docker image
Resource with id [TestUpdateSchedule] is invalid. Runtime, Handler, Layers cannot be present when PackageType is of type `Image`.
Read more >
Let's Try Lambda Container Support with SAM CLI - hayao-k.dev
The AWS SAM CLI supports container images in v1.13.1. ... Image (artifact is an image uploaded to an ECR image repository) Package type:...
Read more >
Support for PackageType: Image in aws-sam-deploy Pipe - Jira
Use the AWS CLI directly (i.e. using sam package and sam deploy commands in their build script). Fastest option. Wait until we add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found