Skip to content

Commit

Permalink
fix: Use S3 Upload function instead of PutObjectCommand (#218)
Browse files Browse the repository at this point in the history
* chore: use upload instead of PutObject

* chore: update aws-sdk versions

* chore: add lib-storage to projen deps
  • Loading branch information
jadenv authored Jul 13, 2024
1 parent 2d9c5a3 commit 8e1e853
Show file tree
Hide file tree
Showing 6 changed files with 944 additions and 775 deletions.
4 changes: 4 additions & 0 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
devDeps: [
'@aws-crypto/sha256-js',
'@aws-sdk/client-s3',
'@aws-sdk/lib-storage',
'@mrgrain/jsii-struct-builder',
'@smithy/signature-v4',
'@types/adm-zip',
Expand Down
3 changes: 2 additions & 1 deletion package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/lambdas/nextjs-bucket-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
type PutObjectCommandInput,
S3Client,
} from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
import type { CloudFormationCustomResourceHandler } from 'aws-lambda';
import type * as JSZipType from 'jszip';
// @ts-ignore jsii doesn't support esModuleInterop
Expand Down Expand Up @@ -292,7 +293,7 @@ async function uploadObjects({
};
});

await Promise.all(putObjectInputs.map((input) => s3.send(new PutObjectCommand(input))));
await Promise.all(putObjectInputs.map((params) => new Upload({ client: s3, params }).done()));
}
}

Expand Down
Loading

0 comments on commit 8e1e853

Please sign in to comment.