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

fix(lambda): update default runtimes and tests to node 16 everywhere #26921

Merged
merged 25 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e25dc92
fix(lambda): update default runtimes and tests to node 16
mrgrain Jul 30, 2023
f8e8cc3
update unit tests
mrgrain Aug 29, 2023
48b1de8
update more tests
mrgrain Aug 29, 2023
50c2bfa
update more snapshots
mrgrain Aug 29, 2023
9b4da5a
update even more snaps
mrgrain Aug 29, 2023
ea00373
update a lot of snapshots
mrgrain Aug 29, 2023
cb1feda
three more snapshots
mrgrain Aug 29, 2023
89860cb
another snapshots
mrgrain Aug 29, 2023
4f9ba8a
dry-run, this can never work with the hardcoded domain name
mrgrain Aug 29, 2023
b81b668
dry-run; requires oracle license that is not available to me
mrgrain Aug 29, 2023
ebde67a
fix another integ test
mrgrain Aug 29, 2023
1d04e89
update docs and a few more tests
mrgrain Aug 29, 2023
075bce0
some more docs and tests
mrgrain Aug 29, 2023
f67c333
fix another unit test
mrgrain Aug 29, 2023
8f5cfaa
yet another unit test
mrgrain Aug 29, 2023
6d3de76
fix integ.graphql-iam-integ.graphql-iam
mrgrain Aug 29, 2023
cef6511
dry-run, does not deploy due to missing prerequisites
mrgrain Aug 29, 2023
3687d5d
dry-run, the test has lost the required certificate files, but they a…
mrgrain Aug 29, 2023
3efaadb
Merge branch 'main' into mrgrain/fix/no-node-14
mrgrain Aug 30, 2023
5c58a18
explain undeployable tests
mrgrain Aug 30, 2023
87a1d55
fix more integ tests
mrgrain Aug 30, 2023
e66828d
Merge branch 'main' into mrgrain/fix/no-node-14
mrgrain Aug 30, 2023
640b750
fix two more tests
mrgrain Aug 30, 2023
acb97f9
fix lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js
mrgrain Aug 30, 2023
a037896
dry-run, stack deploys but assertions fail due to bug in sdk assertio…
mrgrain Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const app = new App();
const stack = new Stack(app, 'RequestAuthorizerInteg');

const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const app = new App();
const stack = new Stack(app, 'TokenAuthorizerIAMRoleInteg');

const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = new App();
const stack = new Stack(app, 'TokenAuthorizerInteg');

const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TestStack extends Stack {
});

const handler = new lambda.Function(this, 'handler', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'integ.cors.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LambdaApiIntegrationOptionsNonProxyIntegrationStack extends Stack {

const fn = new Function(this, 'myfn', {
code: Code.fromInline('foo'),
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_16_X,
handler: 'index.handler',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LateBoundDeploymentStageStack extends Stack {

const fn = new Function(this, 'myfn', {
code: Code.fromInline('foo'),
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_16_X,
handler: 'index.handler',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stack = new Stack(app, 'aws-cdk-lambda-1');
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

const apigw = new RestApi(stack, 'MyRestApi', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ class BookStack extends cdk.Stack {
super(scope, id);

const booksHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BooksHandler', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = ${echoHandlerCode}`),
}));

const bookHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BookHandler', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = ${echoHandlerCode}`),
}));

const hello = new apigw.LambdaIntegration(new lambda.Function(this, 'Hello', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = ${helloCode}`),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FirstStack extends cdk.Stack {
}
}`),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MultiStack extends cdk.Stack {
super(scope, id);

const hello = new apigw.LambdaIntegration(new lambda.Function(this, 'Hello', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = ${helloCode}`),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Test extends cdk.Stack {
});

const handler = new lambda.Function(this, 'MyHandler', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
code: lambda.Code.fromInline(`exports.handler = ${handlerCode}`),
handler: 'index.handler',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Test extends cdk.Stack {
});

const handler = new lambda.Function(this, 'MyHandler', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
code: lambda.Code.fromInline(`exports.handler = ${handlerCode}`),
handler: 'index.handler',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = new appsync.GraphqlApi(stack, 'LambdaAPI', {
const func = new lambda.Function(stack, 'func', {
code: lambda.Code.fromAsset(path.join(__dirname, 'verify/lambda-tutorial')),
handler: 'lambda-tutorial.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

const lambdaDS = api.addLambdaDataSource('LambdaDS', func);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ api.grantMutation(lambdaIAM, 'addTest');
new Function(stack, 'testQuery', {
code: Code.fromAsset(join(__dirname, 'verify/iam-query')),
handler: 'iam-query.handler',
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_16_X,
environment: { APPSYNC_ENDPOINT: api.graphqlUrl },
role: lambdaIAM,
});
new Function(stack, 'testFail', {
code: Code.fromAsset(join(__dirname, 'verify/iam-query')),
handler: 'iam-query.handler',
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_16_X,
environment: { APPSYNC_ENDPOINT: api.graphqlUrl },
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GraphQLApiLambdaAuthStack extends cdk.Stack {
path.join(__dirname, 'verify/lambda-tutorial'),
),
handler: 'lambda-tutorial.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

new appsync.GraphqlApi(this, 'api1', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestStack extends Stack {

const serviceToken = CustomResourceProvider.getOrCreate(this, resourceType, {
codeDirectory: `${__dirname}/core-custom-resource-provider-fixture`,
runtime: CustomResourceProviderRuntime.NODEJS_14_X,
runtime: CustomResourceProviderRuntime.NODEJS_16_X,
description: 'veni vidi vici',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestStack extends Stack {
new lambda.Function(this, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
logRetention: RetentionDays.ONE_DAY,
});
const logRetentionFunction = this.node.tryFindChild('LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a')!;
Expand All @@ -47,12 +47,12 @@ class TestNestedStack extends Stack {
const resource1 = new lambda.Function(stack1, 'Lambda1', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
}).node.defaultChild! as CfnResource;
const resource2 = new lambda.Function(stack2, 'Lambda2', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
}).node.defaultChild! as CfnResource;

// The following two statements should cancel each other out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MyNestedStack extends NestedStack {

if (props.subscriber) {
new lambda.Function(this, 'fn', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
code: lambda.Code.fromInline('console.error("hi")'),
handler: 'index.handler',
environment: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MyNestedStack extends NestedStack {

new lambda.Function(this, 'Handler', {
code: lambda.Code.fromAsset(path.join(__dirname, 'asset-directory-fixture')),
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const sourceBucket = new s3.Bucket(stack, 'Bucket', {
const lambdaFunction = new lambda.Function(stack, 'Lambda', {
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

const lambdaVersion = new lambda.Version(stack, 'LambdaVersion', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const stack = new cdk.Stack(app, 'integ-distribution-lambda-cross-region', { env
const lambdaFunction = new cloudfront.experimental.EdgeFunction(stack, 'Lambda', {
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

const lambdaFunction2 = new cloudfront.experimental.EdgeFunction(stack, 'Lambda2', {
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
stackId: `edge-lambda-stack-${region}-2`,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const stack = new cdk.Stack(app, 'integ-distribution-lambda', { env: { region: '
const lambdaFunction = new lambda.Function(stack, 'Lambda', {
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

new cloudfront.Distribution(stack, 'Dist', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const bucket = new s3.Bucket(stack, 'Bucket', {
autoDeleteObjects: true,
});
const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'hello.handler',
code: lambda.Code.fromInline('exports.handler = {}'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const bucket = new s3.Bucket(stack, 'Bucket', {
});
const topic = new sns.Topic(stack, 'Topic');
const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'hello.handler',
code: lambda.Code.fromInline('exports.handler = {}'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda');
const handler = new lambda.Function(stack, 'Handler', {
code: lambda.Code.fromAsset(path.join(__dirname, 'handler')),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});
const version = handler.currentVersion;
const blueGreenAlias = new lambda.Alias(stack, 'Alias', {
Expand All @@ -21,12 +21,12 @@ const blueGreenAlias = new lambda.Alias(stack, 'Alias', {
const preHook = new lambda.Function(stack, 'PreHook', {
code: lambda.Code.fromAsset(path.join(__dirname, 'preHook')),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});
const postHook = new lambda.Function(stack, 'PostHook', {
code: lambda.Code.fromAsset(path.join(__dirname, 'postHook')),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

new codedeploy.LambdaDeploymentGroup(stack, 'BlueGreenDeployment', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const lambdaCode = lambda.Code.fromCfnParameters();
new lambda.Function(lambdaStack, 'Lambda', {
code: lambdaCode,
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});
// other resources that your Lambda needs, added to the lambdaStack...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const lambdaFun = new lambda.Function(stack, 'LambdaFun', {
};
`),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});
const lambdaStage = pipeline.addStage({ stageName: 'Lambda' });
lambdaStage.addAction(new cpactions.LambdaInvokeAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const app = new App();
const stack = new Stack(app, 'integ-user-pool-custom-sender');

const customSenderLambda = new lambda.Function(stack, 'emailLambda', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { console.log("Mocked custom email send");return cb(null, "success"); }'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function dummyTrigger(name: string): IFunction {
return new Function(stack, name, {
functionName: name,
handler: 'index.handler',
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_16_X,
code: Code.fromInline('foo'),
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-config-custompolicy');
const fn = new lambda.Function(stack, 'CustomFunction', {
code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

new config.CustomRule(stack, 'Custom', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-config-rule-scoped-integ', {});
const fn = new lambda.Function(stack, 'CustomFunction', {
code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
});

new config.CustomRule(stack, 'Custom', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ImportCertificates extends Construct {

const serviceToken = CustomResourceProvider.getOrCreate(this, IMPORT_CERTIFICATES_RESOURCE_TYPE, {
codeDirectory: path.join(__dirname, 'import-certificates-handler'),
runtime: CustomResourceProviderRuntime.NODEJS_14_X,
runtime: CustomResourceProviderRuntime.NODEJS_16_X,
policyStatements: [{
Effect: 'Allow',
Action: ['acm:ImportCertificate', 'acm:DeleteCertificate'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'lambda-events');

const fn = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestStack extends Stack {
this.queue = new sqs.Queue(this, 'Queue');

this.fn = new lambda.Function(this, 'SnsSqs', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = async (event) => {
if (event.status === 'OK') return 'success';
Expand All @@ -35,15 +35,15 @@ class TestStack extends Stack {
});

const onSuccessLambda = new lambda.Function(this, 'OnSucces', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = async (event) => {
console.log(event);
};`),
});

new lambda.Function(this, 'EventBusLambda', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = async (event) => {
if (event.status === 'OK') return 'success';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestStack extends Stack {
super(scope, id, props);

const lambdaProps: lambda.FunctionProps = {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`exports.handler = async (event) => {
console.log('Event: %j', event);
Expand Down
Loading
Loading