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.Handler.FROM_IMAGE not resolving during build #25758

Closed
ETisREAL opened this issue May 26, 2023 · 3 comments
Closed

lambda:lambda.Handler.FROM_IMAGE not resolving during build #25758

ETisREAL opened this issue May 26, 2023 · 3 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@ETisREAL
Copy link

Describe the bug

When I launch the stack I get this error:

Error: handler must be Handler.FROM_IMAGE when using image asset for Lambda function

Expected Behavior

This is my code:

const openapiEdgeLambda = new cloudfront.experimental.EdgeFunction(this, 'openapiSignURLHandler', {
            functionName: 'openapiSignURLHandler',
            handler: lambda.Handler.FROM_IMAGE,
            runtime: lambda.Runtime.FROM_IMAGE,
            code: lambda.Code.fromDockerBuild('resources/lambdas/openapi-python/'),
            logRetention: RetentionDays.ONE_DAY,
            environment: {
                'OPENAPI_URL': `https://${config.openapiDomainName[0]}`,
                'OPENAPI_ACCESS_KEY_ID': this.openapiKeyId.publicKeyId,
                'OPENAPI_PRIVATE_KEY': process.env.OPENAPI_PRIVATE_KEY as string
            },
            description: 'Lambda function responsibile for signing URL to access openapi documentation from tournaments.qlash.gg'
        })

as you can see I am specifying the handler as FROM_IMAGE

Current Behavior

I get this error:

Error: handler must be Handler.FROM_IMAGE when using image asset for Lambda function

Reproduction Steps

Simply launch the stack with the following code and this Dockerfile

FROM public.ecr.aws/lambda/python:3.8

RUN  pip3 install cryptography boto3 --target "/asset"

WORKDIR /asset

COPY openapi-sign-url.py .

COPY STGopenapiKey.pem .
ENV OPENAPI_ACCESS_KEY_ID=K17L208H5RTTN9
ENV OPENAPI_URL=https://stg.docs.qlash.gg/

CMD [ "openapi-sign-url.lambda_handler" ] 

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.80

Framework Version

No response

Node.js Version

v18.04

OS

Linux - Ubuntu

Language

Typescript

Language Version

No response

Other information

No response

@ETisREAL ETisREAL added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 26, 2023
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label May 26, 2023
@pahud
Copy link
Contributor

pahud commented May 30, 2023

lambda.Code.fromDockerBuild essentially create a container image assets but from what I can see in the doc - Supported Runtimes, the edge functions only support nodejs and python runtimes. Did you see any example using docker image assets for edge functions in CDK?

@pahud pahud added p2 effort/medium Medium work item – several days of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels May 30, 2023
@ETisREAL
Copy link
Author

I don't know, I'm not sure if I ever saw it as an example actually. I just opted for using Inline code. Thank you anyway

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 30, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants