Skip to content

Commit

Permalink
fix: do not duplicate middleware inside the aws-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Nov 4, 2024
1 parent a4e3e98 commit 68b91f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/shared/src/file.system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export const s3FsPublic = new FsAwsS3(
/** Ensure middleware are added to all s3 clients that are created */
function applyS3MiddleWare(fs: FsAwsS3): void {
if (fs.s3 == null) return;
fs.s3.middlewareStack.add(Fqdn.middleware, { name: 'FQDN', step: 'finalizeRequest' });
const stacks = fs.s3.middlewareStack.identify();
if (stacks.find((f) => f.startsWith('FQDN - ')) == null) {
fs.s3.middlewareStack.add(Fqdn.middleware, { name: 'FQDN', step: 'finalizeRequest' });
}
}

applyS3MiddleWare(s3FsPublic);
Expand Down

0 comments on commit 68b91f4

Please sign in to comment.