Sam Hulick
12/20/2021, 10:55 PM$LATEST
version of the function. how do I make it point to the specific version? and more importantly, how do I ensure that when I update the code and the Lambda version gets bumped, that anything else that depends on that Lambda func updates its reference? I would think if I create an SST function using provisioned concurrency and i pass that function as an API route, it the API Gateway integration would point to the version, but it doesn’tSam Hulick
12/20/2021, 11:39 PMfunc.currentVersion
into the API route defFrank
Sam Hulick
12/21/2021, 12:10 AMError: Invalid function definition for the "Lambda_GET_/embeds/{embedId}" Function
at Function.fromDefinition (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/resources/src/Function.ts:512:11)
at Api.createFunctionIntegration (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/resources/src/Api.ts:575:23)
at Api.addRoute (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/resources/src/Api.ts:470:26)
Sam Hulick
12/21/2021, 12:11 AMSam Hulick
12/21/2021, 12:14 AMlambda.Alias()
using that version, then pass that into the route defFrank
sst.Api
doesn’t accept a versioned Lambda. Can you try adding the versioned function as a route manually, something like this?
import * as apig from "@aws-cdk/aws-apigatewayv2";
import * as apigIntegrations from "@aws-cdk/aws-apigatewayv2-integrations";
// Create the Api without the route with versioned function
const api = new sst.Api(...);
// Create an new route integration with the versioned function
const integration = new apigIntegrations.LambdaProxyIntegration({
handler: myFunction.currentVersion,
payloadFormatVersion: apig.PayloadFormatVersion.VERSION_2_0,
});
// Add the new route to the Api
const route = new apig.HttpRoute(scope, `VerionedRoute`, {
httpApi: api.httpApi,
routeKey: apig.HttpRouteKey.with("/path/to/route", "GET"),
integration,
});
Frank
Frank
Frank
Sam Hulick
12/21/2021, 12:50 AMmyApi.addRoutes(this, {
'GET /things/{id}': route
})
Frank
addRoutes
Sam Hulick
12/21/2021, 10:00 PMaddRoutes
. basically I create the “base API” and then pass that into each stack, and each of those stacks adds on the specific routesFrank
addRoutes
for adding normal routes. But for routes that uses a specific Function version, addRoutes
currently doesn’t support that.Sam Hulick
12/21/2021, 10:02 PMFrank
addRoutes
and manually adds a new route with the Function version.Sam Hulick
12/21/2021, 10:03 PMFrank
addRoutes()
and pass in a version.Frank
Sam Hulick
12/21/2021, 10:04 PMSam Hulick
12/21/2021, 10:04 PMFrank
Cron
that calls the function would work.Sam Hulick
12/21/2021, 10:05 PMFrank
new Cron(this, "Cron", {
schedule: "rate(3 minutes)",
job: {
function: {
handler: "src/warn.main",
environment: {
FUNCTION_NAME: api.getFunction("GET /route/to/warm"),
},
},
},
});
and the function code for warm.js
const lambda = new AWS.Lambda();
await lambda.invoke({
FunctionName: process.env.FUNCTION_NAME,
InvocationType: "Event",
}).promise();
Sam Hulick
12/21/2021, 10:12 PMSam Hulick
12/21/2021, 10:14 PMFrank
Haseeb Naseem
02/19/2022, 5:18 PMUPDATE_FAILED | AWS::Lambda::Version | RestApiLambdaCurrentVersion852D2DA360a377647a092f1d514208146cd7b343 | Internal Failure
I can’t find any information on this. Would you know anything about this or what could I do to debug this ?Frank
Haseeb Naseem
02/22/2022, 5:22 AMFrank
Haseeb Naseem
02/23/2022, 7:31 AMthis.api = new sst.API(this, "API, {
customDomain: {
...,
}
});
const LambdaFn = new sst.Function(this, "ApiLambda", {
...,
currentVersionOptions:{
provisionedConcurrentExecutions: 5,
}
});
const version = LambdaFn.currentVersion;
const integration = new apigIntegrations.HttpLambdaIntegration("ApiVersionIntegration", LambdaFn.currentVersion, {
payloadFormatVersion: apig.PayloadFormatVersion.VERSION_2_0
});
const route = new apig.HttpRoute(this, "someroute", {
httpApi: this.api.httpApi,
routeKey: apig.HttpRouteKey.with("/api/{proxy+}", apig.HttpMethod.ANY),
integration
});
Frank
Haseeb Naseem
02/24/2022, 5:47 AMHaseeb Naseem
02/24/2022, 11:44 AMFrank
Frank
Haseeb Naseem
03/04/2022, 12:46 PMFrank
Frank
Frank
Haseeb Naseem
03/05/2022, 10:15 PMHaseeb Naseem
03/07/2022, 8:03 AMJesús Hernández
05/30/2022, 11:10 AMUPDATE_FAILED | AWS::Lambda::Version … | Internal Failure
Jesús Hernández
05/30/2022, 11:10 AMHaseeb Naseem
05/30/2022, 11:12 AMJesús Hernández
05/30/2022, 11:15 AMHaseeb Naseem
05/30/2022, 11:16 AMJesús Hernández
05/30/2022, 11:19 AMJesús Hernández
05/30/2022, 1:28 PMsst remove
my app and re deployed it again. Now it does not complain when adding the lambda with provisioned capacityJesús Hernández
05/30/2022, 1:31 PMHaseeb Naseem
05/31/2022, 6:51 AMJesús Hernández
06/02/2022, 10:17 AMJesús Hernández
06/02/2022, 10:17 AMJesús Hernández
06/02/2022, 10:23 AMJesús Hernández
06/02/2022, 10:30 AM