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.

Can't create Lambda function using container runtime

See original GitHub issue

Describe the bug I’m trying to create a lambda function using a container image runtime. It fails with the error:

botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Runtime and Handler are mandatory parameters for functions created with deployment packages.

When I put Runtime and Handler parameters, it fails again with error:

botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Please provide a source for function code.

I don’t see why do I have to put Runtime and Handler parameters with a container runtime, when those parameters are managed by the container itself. In the AWS console, you only need to specify the image URI. What am I doing wrong?

Steps to reproduce

import boto3

aws_session = boto3.Session()
lambda_client = aws_session.client('lambda', region_name='us-east-1')
image_uri = '1234567890.dkr.ecr.us-east-1.amazonaws.com/lambda-container:latest'

response = lambda_client.create_function(
    FunctionName='container_test',
    Role='arn:aws:iam::1234567890:role/lambda-role',
    Code={
        'ImageUri': image_uri
    },
    Timeout=600,
    MemorySize=1024
)

Expected behavior Create lambda function as container runtime with the URI image specified.

Debug logs https://gist.github.com/aitorarjona/3e41603abd271736a3e1a28b505f0b07

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
umegayacommented, Dec 23, 2020

@aitorarjona hi, I’m author of lua-aws and encountered same problem. in my case, problem is missing parameter. in brief, PayloadType = “Image” is required like this.

hope this helps you 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Lambda container images - AWS Documentation
Create a container image for a Lambda function by using an AWS provided base image or an alternative base image.
Read more >
Deploying Lambda functions as container images
Creating the function · Open the Functions page of the Lambda console. · Choose Create function. · Choose the Container image option. ·...
Read more >
Using container images with AWS Lambda | by Michael Hart
I've shown how you can use existing docker tooling to create and test your container images locally — including a full integration test...
Read more >
Package your Lambda function as a container image - Lumigo
You can't run long-running services in Lambda, your code is still bound by Lambda's invocation model (i.e., it only runs when the function...
Read more >
AWS Lambda with custom docker images as runtime
Learn how to build and deploy an AWS Lambda function with a custom python docker container as runtime with the use of Amazon...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found