Skip to content

Commit

Permalink
chore: Attempt change with esbuild injection to ensure ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
KenFigueiredo committed Oct 7, 2024
1 parent 023963d commit bcb87d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 0 additions & 5 deletions files/deployable/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Mitigation for https://github.com/awslabs/cognito-at-edge/issues/86
// This won't fix all situations but this does seem to help reduce the total amount of 503 errors
// that occur from cognito-at-edge due to timeouts.
process.env['AWS_NODEJS_CONNECTION_REUSE_ENABLED'] = '1';

const { IAMClient, GetRolePolicyCommand } = require('@aws-sdk/client-iam');
const { SSMClient, GetParameterCommand } = require('@aws-sdk/client-ssm');
const { STSClient, GetCallerIdentityCommand } = require('@aws-sdk/client-sts');
Expand Down
2 changes: 1 addition & 1 deletion files/deployable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Cognito@Edge wrapper to clean up",
"main": "index.js",
"scripts": {
"postinstall": "esbuild index.js --bundle --minify --platform=node --target=node20 --format=cjs --main-fields=module,main '--external:@aws-sdk/*' --outdir=dist"
"postinstall": "esbuild index.js --bundle --minify --platform=node --target=node20 --format=cjs --main-fields=module,main '--external:@aws-sdk/*' --outdir=dist --inject:prefix.js"
},
"author": "Ken Figueiredo",
"license": "TOST",
Expand Down
4 changes: 4 additions & 0 deletions files/deployable/prefix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Mitigation for https://github.com/awslabs/cognito-at-edge/issues/86
// This won't fix all situations but this does seem to help reduce the total amount of 503 errors
// that occur from cognito-at-edge due to timeouts.
process.env['AWS_NODEJS_CONNECTION_REUSE_ENABLED'] = '1';

0 comments on commit bcb87d9

Please sign in to comment.