Skip to content

Commit f7153bd

Browse files
committed
Upgrade deps and fix CloudFormation
1 parent 45c2118 commit f7153bd

File tree

11 files changed

+318
-171
lines changed

11 files changed

+318
-171
lines changed

.github/workflows/npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
pip3 install awscli --upgrade --user
3333
- name: NVM Install
3434
run: |
35-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
35+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
3636
. $HOME/.nvm/nvm.sh
3737
nvm install
3838
- name: NPM Install

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.13.1
1+
v20.11.0

cloudformation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Resources:
99
Type: AWS::Serverless::LayerVersion
1010
Properties:
1111
LayerName: !Ref LayerName
12-
CompatibleRuntimes: [nodejs18.x]
12+
CompatibleRuntimes: [nodejs20.x]
1313
ContentUri: dist/layer.zip
1414
LicenseInfo: Apache-2.0
1515
S3UploadCustomResourceLayerPermission:

package-lock.json

Lines changed: 287 additions & 156 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/handler/handle-create.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { S3UploadConfig } from "../s3-upload-config";
66
import { S3_UPLOAD_CONFIG_FILE } from "../resources";
77

88
export class CreateHandler extends EventHandler {
9+
protected requireValidS3UploadConfig(): boolean {
10+
return true;
11+
}
12+
913
protected async handleEvent(
1014
parameters: RequestParameters,
1115
simpleS3: SimpleS3,

src/handler/handle-delete.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { SimpleFs } from "../simple-fs";
44
import { ResponseStatus } from "../cloudformation-types";
55

66
export class DeleteHandler extends EventHandler {
7+
protected requireValidS3UploadConfig(): boolean {
8+
return false;
9+
}
10+
711
protected async handleEvent(
812
parameters: RequestParameters,
913
simpleS3: SimpleS3,

src/handler/handle-update.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { S3UploadConfig } from "../s3-upload-config";
66
import { S3_UPLOAD_CONFIG_FILE } from "../resources";
77

88
export class UpdateHandler extends EventHandler {
9+
protected requireValidS3UploadConfig(): boolean {
10+
return true;
11+
}
12+
913
protected async handleEvent(
1014
parameters: RequestParameters,
1115
simpleS3: SimpleS3,

src/handler/handler.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ export abstract class EventHandler {
4545
const s3UploadConfigString = simpleFs.readFile(S3_UPLOAD_CONFIG_FILE).toString();
4646
s3UploadConfig = new S3UploadConfig(s3UploadConfigString);
4747
} catch (e) {
48-
await callback({
49-
status: ResponseStatus.FAILED,
50-
reason: `Unable to read or parse ${S3_UPLOAD_CONFIG_FILE}: ${(
51-
e as Error
52-
).toString()}`,
53-
});
54-
return;
48+
if (this.requireValidS3UploadConfig()) {
49+
await callback({
50+
status: ResponseStatus.FAILED,
51+
reason: `Unable to read or parse ${S3_UPLOAD_CONFIG_FILE}: ${(
52+
e as Error
53+
).toString()}`,
54+
});
55+
return;
56+
}
5557
}
5658
}
5759

@@ -68,6 +70,8 @@ export abstract class EventHandler {
6870
await callback(result);
6971
}
7072

73+
protected abstract requireValidS3UploadConfig(): boolean;
74+
7175
protected abstract handleEvent(
7276
parameters: RequestParameters,
7377
simpleS3: SimpleS3,

tst/example-project/bucket-cloudformation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Resources:
2222
Layers: [!Ref S3UploadLambdaLayerArn]
2323
CodeUri: "!!!source-root!!!"
2424
Handler: s3-upload-custom-resource.handler
25-
Runtime: nodejs18.x
26-
Timeout: 30
25+
Runtime: nodejs20.x
26+
Timeout: 300
2727
Policies:
2828
- S3CrudPolicy:
2929
BucketName: !Ref BucketName

tst/example-project/cloudformation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Resources:
1818
Layers: [!Ref S3UploadLambdaLayerArn]
1919
CodeUri: "!!!source-root!!!"
2020
Handler: s3-upload-custom-resource.handler
21-
Runtime: nodejs18.x
22-
Timeout: 30
21+
Runtime: nodejs20.x
22+
Timeout: 300
2323
Policies:
2424
- S3CrudPolicy:
2525
BucketName: !Ref RootTestBucket

0 commit comments

Comments
 (0)