When using python runtime, is there a way to skip ...
# help
g
When using python runtime, is there a way to skip the default python bundling and deploy to your own docker container runtime. I tried the following which satisfies types but fails on deploy.
Copy code
// build from custom docker image 
const processFunc = new lambda.DockerImageFunction(this, "ProcessGifUrl", { "code": lambda.DockerImageCode.fromImageAsset("./") });
    const func = lambda.Function.fromFunctionArn(this, "ProcessFunc", processFunc.functionArn);

...
// api config
   routes: {
        "POST /process-gif": {
          function: func,
          methodOptions: {
            apiKeyRequired: true,
            authorizationType: AuthorizationType.NONE
          }
        },
f
Hey @George Evans, what’s the error you are getting?
g
Copy code
Error: Invalid function definition for the "Lambda_POST_/do-not-use" Function
    at Function.fromDefinition
However I have actually work out a way to do it
ended up using the cdk functions to attach it to the gateway:
Copy code
const processFunc = new lambda.DockerImageFunction(this, "ProcessGifUrl", {
      code: lambda.DockerImageCode.fromImageAsset("./", { file :"infrastructure/Dockerfile" }),
      timeout: Duration.seconds(30),
      memorySize: 1024,
      environment: {
        S3_ASSETS_BUCKET: bucket.s3Bucket.bucketName
      }
    });
    const integration = new LambdaIntegration(processFunc);
    const resource = api.restApi.root.addResource("process-gif", {
      defaultMethodOptions: {
        apiKeyRequired: true,
        authorizationType:  AuthorizationType.NONE,
      }
    });

    resource.addMethod("POST", integration)
would be cool if sst supported this out of the box though
f
Yeah for sure. Lemme open an issue for this. This is for
ApiGatewayV1Api
right?
g
yeah 👍
g
awesome cheers!
g
@Frank 👍 this request. I’m also trying to attach a Docker Lambda runtime to my API and not being able to
f
@George Evans @Guy Shechter We are working on a change to support
lambda.DockerImageFunction
for most of our construct.
Are you using the
sst.Api
construct? I can push out a release to support that first.
g
yes sst.Api
f
Got it! Will keep you posted!
g
I'm using sst.ApiGatewayV1Api currently but no rush as the workaround we have is ok for our use case for now 👍
f
Quick update. We should have something later this week/early next week.