Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda with cognito-at-edge too big for CloudFront #93

Open
chbk opened this issue Mar 6, 2024 · 1 comment
Open

Lambda with cognito-at-edge too big for CloudFront #93

chbk opened this issue Mar 6, 2024 · 1 comment

Comments

@chbk
Copy link

chbk commented Mar 6, 2024

What happened:

Error: updating CloudFront Distribution: InvalidLambdaFunctionAssociation: The function code size is larger than the maximum allowed size for functions that are triggered by a CloudFront event: 1423536 Max allowed: 1048576

What did you expect to have happen:

No issues with cognito-at-edge version 1.5.0

How to reproduce this (as precisely and succinctly as possible):

package.json

{
  "name": "lambda",
  "dependencies": {
    "cognito-at-edge": "1.5.1"
  }
}

npm install

Then zip files and update lambda.

Environment:

cognito-at-edge version
1.5.1
node --version
v20.11.0
npm --version
10.2.4

@jeandek
Copy link
Contributor

jeandek commented Mar 7, 2024

Hi @chbk,

We use the CDK's NodejsFunction construct to deploy our test environments and we did not encounter any issues. Presumably esbuild is able to optimize and reduce the package size even with the default settings (no minify, etc.).

Unless you need the bug fix included in the latest version, I would recommend sticking to 1.5.0 for now. Long term, we would like to get rid of most of our external dependencies (axios and pica), but I can't commit to a specific timeline.

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants