Skip to content

Commit e47d448

Browse files
authored
Merge pull request #1471 from aligent/chore/DO-1852_address_pipeline_issue
Chore/do 1852 address pipeline issue
2 parents 46e32a1 + e98e9ef commit e47d448

File tree

3 files changed

+1910
-2760
lines changed

3 files changed

+1910
-2760
lines changed

packages/static-hosting/lib/handlers/csp-lambda/origin-response.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CloudFrontResponseEvent, CloudFrontResponse } from "aws-lambda";
2-
import { S3 } from "aws-sdk"; // Lambda comes pre-bundled with SDK v2, so use that instead of v3 for now
2+
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
33

4-
const s3 = new S3();
4+
const s3 = new S3Client({});
55

66
const CSP_OBJECT = process.env.CSP_OBJECT;
77
const S3_BUCKET = process.env.S3_BUCKET;
@@ -32,18 +32,15 @@ export const handler = async (
3232
throw new Error("CSP_FILE or S3_BUCKET environment variable is missing");
3333
}
3434

35-
const params: S3.GetObjectRequest = {
36-
Bucket: S3_BUCKET,
37-
Key: CSP_OBJECT,
38-
};
35+
const params = { Bucket: S3_BUCKET, Key: CSP_OBJECT };
3936

40-
const s3Object = await s3.getObject(params).promise();
37+
const s3Object = await s3.send(new GetObjectCommand(params));
4138

4239
if (!s3Object.Body) {
4340
throw new Error("CSP file is empty or missing");
4441
}
4542

46-
csp += s3Object.Body.toString("utf-8");
43+
csp += s3Object.Body.toString();
4744

4845
console.log("CSP file retrieved:", csp);
4946

packages/static-hosting/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aligent/cdk-static-hosting",
3-
"version": "2.4.0",
3+
"version": "2.7.1",
44
"main": "index.js",
55
"license": "GPL-3.0-only",
66
"homepage": "https://github.com/aligent/aws-cdk-static-hosting-stack#readme",
@@ -24,6 +24,7 @@
2424
"typescript": "^5.3.2"
2525
},
2626
"dependencies": {
27+
"@aws-sdk/client-s3": "^3.787.0",
2728
"source-map-support": "^0.5.21"
2829
},
2930
"peerDependencies": {

0 commit comments

Comments
 (0)