salmon-thailand-93496
06/03/2023, 1:16 AMimport * as apigateway from "@pulumi/aws-apigateway";
import * as aws from "@pulumi/aws";
const lambda = new aws.lambda.Function(lambdaName, {
name: lambdaName,
code: repositoryImage.imageUri,
handler: 'index.handler',
...
});
const api = new apigateway.RestAPI(apiName, {
routes: [{
path: "/route",
method: "POST",
eventHandler: lambda
}]
})
This construction used to work for me in the earlier versions, but right now, it gives me this error:
TS2322: Type 'Function' is not assignable to type 'Input<Function> | undefined'. Type 'Function' is missing the following properties from type 'Function': ephemeralStorage, qualifiedInvokeArn, replaceSecurityGroupsOnDestroy, replacementSecurityGroupIds, and 2 more.
So it looks like new aws.lambda.Function
doesn’t return the type expected by the eventHandler
.
In the documentation, the route seems to work if the lambda is a CallbackFunction
, but I certainly don’t want a Callback Function as the lambda because the lambda code is coming from Docker, and involves many dependencies, etc..
Any idea?miniature-musician-31262
06/05/2023, 9:17 PMclassic
namespace to continue using the previous behavior? For example, this might work for you:
import * as awsx from "@pulumi/awsx";
const api = new awsx.classic.apigateway.API("api", {
routes: [
{
path: "/route",
method: "GET",
eventHandler: someCallbackOrLambdaFunction,
},
]
});
salmon-thailand-93496
06/06/2023, 12:23 AMminiature-musician-31262
06/06/2023, 12:36 AMsalmon-thailand-93496
06/06/2023, 12:41 AMminiature-musician-31262
06/06/2023, 12:41 AMapigateway.RestAPI
as well. Lemme doublecheck.awsx.classic
and use apigateway.RestAPI
. Seems fine. 🙂salmon-thailand-93496
06/06/2023, 2:17 AMglamorous-wolf-31414
06/09/2023, 5:38 PMDockerfile:1
--------------------
1 | >>> FROM public.ecr.aws/lambda/nodejs:18
2 |
3 | # Assumes your function is named "app.js", and there is a package.json file in the app directory
--------------------
ERROR: failed to solve: public.ecr.aws/lambda/nodejs:18: pulling from host public.ecr.aws failed with status code [manifests 18]: 403 Forbidden
aws:apigateway:RestApi (api):
error: 1 error occurred:
* creating urn:pulumi:mimic-pul-cont::container-with-api-gateway::aws-apigateway:index:RestAPI$aws:apigateway/restApi:RestApi::api: 1 error occurred:
* error creating API Gateway specification: BadRequestException: Errors found during import:
Unable to put integration on 'GET' for resource at path '/route': Invalid ARN specified in the request
Thanks.