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

[lambda] lambda.Runtime.GO_1_X.bundlingDockerImage doesn't exist #9435

Closed
corymhall opened this issue Aug 4, 2020 · 4 comments · Fixed by #9465
Closed

[lambda] lambda.Runtime.GO_1_X.bundlingDockerImage doesn't exist #9435

corymhall opened this issue Aug 4, 2020 · 4 comments · Fixed by #9465
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@corymhall
Copy link
Contributor

The Golang bundlingDockerImage was recently updated to use a new docker image. It looks like there are no images in the dockerhub repository though.

amazon/aws-sam-cli-build-image-go1.x:latest

https://hub.docker.com/r/amazon/aws-sam-cli-build-image-go1.x

Reproduction Steps

Try and create a Golang lambda using bundling.

new lambda.Function(this, 'Function', {
  code: lambda.Code.fromAsset('path', {
    bundling: {
      image: lambda.Runtime.GO_1_X.bundlingDockerImage,
      command: [
        'bash', '-c', [
          `cd /asset-input`,
          `go build -o main`,
          `cp /asset-input/main /asset-output/`
        ].join(' && ')
      ],
      user: 'root',
    }
  }),
  runtime: lambda.Runtime.GO_1_X,
  handler: 'main',
};

Then when trying to deploy

Unable to find image 'amazon/aws-sam-cli-build-image-go1.x:latest' locally
docker: Error response from daemon: manifest for amazon/aws-sam-cli-build-image-go1.x:latest not found: manifest unknown: manifest unknown.
See 'docker run --help'.

What did you expect to happen?

Should be able to find the image.

Environment

  • **CLI Version :**1.56.0
  • Framework Version:
  • Node.js Version: 12.16.1
  • OS : Ubuntu 18.04.3 LTS
  • Language (Version): TypeScript (3.8.3)

This is 🐛 Bug Report

@corymhall corymhall added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2020
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Aug 4, 2020
@nija-at
Copy link
Contributor

nija-at commented Aug 5, 2020

It looks like there are no images in Dockerhub tagged 'latest' for Go and Dotnetcore.

@iph - do you happen to know about this? Is is just a delay?

@nija-at nija-at added p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 5, 2020
nija-at pushed a commit that referenced this issue Aug 5, 2020
The official docker images for lambda are not available yet for Go and
dotnet core runtimes. Switch back to using lambdaci in these cases.

fixes #9435
@mergify mergify bot closed this as completed in #9465 Aug 6, 2020
mergify bot pushed a commit that referenced this issue Aug 6, 2020
The official docker images for lambda are not available yet for Go and
dotnet core runtimes. Switch back to using lambdaci in these cases.

fixes #9435


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@aripalo
Copy link

aripalo commented Aug 6, 2020

Oh nice, just found this feature myself. Can't wait for #9465 to land 😅 👍

eladb pushed a commit that referenced this issue Aug 10, 2020
The official docker images for lambda are not available yet for Go and
dotnet core runtimes. Switch back to using lambdaci in these cases.

fixes #9435


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@joekendal
Copy link

joekendal commented Jul 15, 2021

It is better to use ECR so that you don't get random rate limits by DockerHub. We had this recently where we couldn't deploy anything. The solution is to just reference the ECR public mirror like so:

new lambda.Function(this, 'Function', {
  code: lambda.Code.fromAsset('path', {
    bundling: {
      image: cdk.DockerImage.from_registry("public.ecr.aws/sam/build-go1.x:latest"),
      ...
    }
  }),
  ...
};

@SamuelCabralCruz
Copy link

@joekendal I recently faced rate limiting issue in my CI job and tried out your approach but then realized that lambda.Runtime.GO_1_X.bundlingImage actually point on aws public ecr by default. at the moment, the best solution I found was to use a github action for caching docker level images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants