diff --git a/files/deployable/index.js b/files/deployable/index.js index eb58426..da70964 100644 --- a/files/deployable/index.js +++ b/files/deployable/index.js @@ -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'); diff --git a/files/deployable/package.json b/files/deployable/package.json index 20b621e..089e4c2 100644 --- a/files/deployable/package.json +++ b/files/deployable/package.json @@ -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", diff --git a/files/deployable/prefix.js b/files/deployable/prefix.js new file mode 100644 index 0000000..1735c9f --- /dev/null +++ b/files/deployable/prefix.js @@ -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';