Karo
02/19/2021, 9:20 PMexport default class APIStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
// Create the HTTP API
const api = new sst.Api(this, "Api", {
defaultFunctionProps: {
runtime: lambda.Runtime.NODEJS_14_X,
},
routes: {
"GET /whoami": "src/api/lambda.whoami",
},
});
Frank
Karo
02/19/2021, 9:20 PMError: The specified runtime is not supported for sst.Function. Only NodeJS runtimes are currently supported.
Karo
02/19/2021, 9:20 PMFrank
Karo
02/19/2021, 9:21 PMimport * as cdk from "@aws-cdk/core";
import * as sst from "@serverless-stack/resources";
import * as lambda from "@aws-cdk/aws-lambda";
Frank
Karo
02/19/2021, 9:22 PMKaro
02/19/2021, 9:23 PM{
"name": "xxx",
"version": "0.1.0",
"private": true,
"scripts": {
"test": "sst test",
"start": "sst start --stage=${USER}",
"build": "sst build",
"deploy": "sst deploy",
"remove": "sst remove"
},
"devDependencies": {
"@aws-cdk/assert": "1.89.0",
"@types/aws-lambda": "^8.10.72"
},
"dependencies": {
"@aws-cdk/core": "1.89.0",
"@serverless-stack/cli": "0.9.5",
"@serverless-stack/resources": "0.9.5"
}
}
Frank
Frank
Frank
Frank
Karo
02/19/2021, 9:30 PMFrank
Karo
02/19/2021, 9:30 PMFrank
Frank
Frank
console.log("my runtime", runtime);
console.log("node14 runtime", lambda.Runtime.NODEJS_14_x);
Karo
02/19/2021, 9:32 PMRuntime2 {
name: 'nodejs14.x',
supportsInlineCode: false,
family: 0,
bundlingDockerImage: BundlingDockerImage {
image: 'amazon/aws-sam-cli-build-image-nodejs14.x',
_imageHash: undefined
},
supportsCodeGuruProfiling: false
}
Karo
02/19/2021, 9:32 PMKaro
02/19/2021, 9:32 PMFrank
Karo
02/19/2021, 9:33 PMmy runtime Runtime2 {
name: 'nodejs14.x',
supportsInlineCode: false,
family: 0,
bundlingDockerImage: BundlingDockerImage {
image: 'amazon/aws-sam-cli-build-image-nodejs14.x',
_imageHash: undefined
},
supportsCodeGuruProfiling: false
}
node14 runtime undefined
Karo
02/19/2021, 9:33 PMFrank
Karo
02/19/2021, 9:33 PMFrank
Karo
02/19/2021, 9:34 PMmy runtime Runtime2 {
name: 'nodejs14.x',
supportsInlineCode: false,
family: 0,
bundlingDockerImage: BundlingDockerImage {
image: 'amazon/aws-sam-cli-build-image-nodejs14.x',
_imageHash: undefined
},
supportsCodeGuruProfiling: false
}
node14 runtime Runtime {
name: 'nodejs14.x',
supportsInlineCode: false,
family: 0,
bundlingDockerImage: BundlingDockerImage {
image: 'amazon/aws-sam-cli-build-image-nodejs14.x',
_imageHash: undefined
},
supportsCodeGuruProfiling: false
}
Karo
02/19/2021, 9:34 PMFrank
Frank
Frank
Frank
Karo
02/19/2021, 9:37 PMFrank
"@aws-cdk/aws-lambda": "1.89.0",
to ur package.json?Frank
aws-lambda
module from other package’s dependency.Karo
02/19/2021, 10:16 PMFrank
Karo
02/19/2021, 10:19 PMKaro
02/19/2021, 10:20 PMKaro
02/19/2021, 10:20 PMFrank
Frank
sst start
into IDEs.Frank
Karo
02/19/2021, 11:38 PMKaro
02/19/2021, 11:38 PMMichael Clifford
02/20/2021, 12:44 AMsst start
to run from VS Code was really easy @FrankFrank
sst start
in VS Code can you set break points in ur function code to step through the code?Michael Clifford
02/20/2021, 12:59 AMincludes
check in your library codeFrank
Michael Clifford
02/20/2021, 1:01 AMFrank
sst start
mode, set Lambda timeout to max (ie. 15min) to give ppl a bit more time to debug without breakpoints without timing out the request.Michael Clifford
02/20/2021, 1:10 AMFrank
Michael Clifford
02/20/2021, 1:12 AMFrank