sladg / nextjs-lambda

Lambda deployments for Nextjs12 & Nextjs13 (standalone). Easy CLI commands to get your standalone Next output to run in AWS Lambda (not @Edge)! Uses CDK in behind and produces code zips importable to Terraform, Serverless, Azure, etc.
MIT License
169 stars 19 forks source link

API Cache not Setting Correctly #83

Closed dvictory closed 1 year ago

dvictory commented 1 year ago

The cachePolicy isn't be set correctly here: https://github.com/sladg/nextjs-lambda/blob/master/lib/cdk/utils/cfnDistro.ts#L62 My deployment does not get set to 0. When I go into AWS console it will not let me change it to 0 either because the "max cannot be less then the default", I think we need to add:

minTtl: Duration.seconds(0),
defaultTtl: Duration.seconds(0),

to the code to disable caching. Without it, my API calls are returning cached/stale data.

sladg commented 1 year ago

Good catch! Wanna open PR with the change? I can get to it by the end of week myself

dvictory commented 1 year ago

Let me see if I can find the time ;)