Skip to content

Commit

Permalink
Merge branch 'main' into events-sns-dlq
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jun 14, 2022
2 parents 7fc9b3d + a014c30 commit 01922bf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runtime code.
* `lambda.Code.fromBucket(bucket, key[, objectVersion])` - specify an S3 object
that contains the archive of your runtime code.
* `lambda.Code.fromInline(code)` - inline the handle code as a string. This is
limited to supported runtimes and the code cannot exceed 4KiB.
limited to supported runtimes.
* `lambda.Code.fromAsset(path)` - specify a directory or a .zip file in the local
filesystem which will be zipped and uploaded to S3 before deployment. See also
[bundling asset code](#bundling-asset-code).
Expand Down
6 changes: 1 addition & 5 deletions packages/@aws-cdk/aws-lambda/lib/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class S3Code extends Code {
}

/**
* Lambda code from an inline string (limited to 4KiB).
* Lambda code from an inline string.
*/
export class InlineCode extends Code {
public readonly isInline = true;
Expand All @@ -249,10 +249,6 @@ export class InlineCode extends Code {
if (code.length === 0) {
throw new Error('Lambda inline code cannot be empty');
}

if (code.length > 4096) {
throw new Error('Lambda source is too large, must be <= 4096 but is ' + code.length);
}
}

public bind(_scope: Construct): CodeConfig {
Expand Down
12 changes: 0 additions & 12 deletions packages/@aws-cdk/aws-lambda/test/code.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ describe('code', () => {
expect(() => defineFunction(lambda.Code.fromInline('boom'), lambda.Runtime.GO_1_X)).toThrow(/Inline source not allowed for go1\.x/);
expect(() => defineFunction(lambda.Code.fromInline('boom'), lambda.Runtime.JAVA_8)).toThrow(/Inline source not allowed for java8/);
});
test('fails if larger than 4096 bytes', () => {
expect(() => defineFunction(lambda.Code.fromInline(generateRandomString(4097)), lambda.Runtime.NODEJS_14_X))
.toThrow(/Lambda source is too large, must be <= 4096 but is 4097/);
});
});

describe('lambda.Code.fromAsset', () => {
Expand Down Expand Up @@ -525,11 +521,3 @@ function defineFunction(code: lambda.Code, runtime: lambda.Runtime = lambda.Runt
runtime,
});
}

function generateRandomString(bytes: number) {
let s = '';
for (let i = 0; i < bytes; ++i) {
s += String.fromCharCode(Math.round(Math.random() * 256));
}
return s;
}

0 comments on commit 01922bf

Please sign in to comment.