NextJsSite Bug Previous person with similar issue:...
# help
d
NextJsSite Bug Previous person with similar issue: https://serverless-stack.slack.com/archives/C01JG3B20RY/p1641330960446700 Actions: Updated from
0.53.2
to
0.58.0
. No other actions. Symptoms:
Copy code
staging-ResonanceWebAppAdminIdentity-AdminIdentityWebAppStack | CREATE_FAILED | AWS::Lambda::Version | AdminIdentityWebAppNextJsSiteApiFunctionCurrentVersion42206DF251f45f4f60760bb3fec1986818833736 | A version for this Lambda function exists ( 2 ). Modify the function to create a new version.
staging-ResonanceWebAppAdminIdentity-AdminIdentityWebAppStack | CREATE_FAILED | AWS::Lambda::Version | AdminIdentityWebAppNextJsSiteImageFunctionCurrentVersionFEA047D3cea01b8892c8bacfeceb61e122debf40 | A version for this Lambda function exists ( 2 ). Modify the function to create a new version.
staging-ResonanceWebAppAdminIdentity-AdminIdentityWebAppStack | UPDATE_FAILED | AWS::Lambda::Function | AdminIdentityWebAppNextJsSiteMainFunctionCFE178A8 | Resource update cancelled
Pinging @Frank, since I am pretty sure he is the Next.js guy. 🙂
f
Haha yup yup~ Taking a look!
Btw, if you make a dummy change to ur Lambda function, does it get around the issue?
d
well, it wouldnt be a lambda persay...but there are superficial changes to the WebApp's code I suppose, just from me updating versions of other packages.
those two lambdas are under full control of
NextJsSite
, and I dont use Next.js API functionality.
i DO use the
Image
, though
although, potentially not on this property, would have to check
f
Can you try setting a different memorySize:
Copy code
new NextjsSite(this, "Site", {
  path: "path/to/site",
  defaultFunctionProps: {
    memorySize: 2048,
  },
});
That should create a different version.
In the mean while, lemme look into the root cause.
d
can do.
it appears to have gotten past the api/image functions
as a potentially irrelevant note, GitHub appears to have bumped node versions from 14.16.0 to 14.18.3, and npm from 6.14.11 to 8.x.x
deployment worked
@Frank, just had this happen to me again on a separate repo with the newest SST installed
actually...same repo, but everything else is different about it
had it happen in two repos in a row, I think it has something to do with not updating code
f
I see. Yup taking a look!
Hey @Derek Kershner, I just did some digging and wanted to shared what I found. TLDR; it’s a bug in how CDK generated Lambda versions, and it should’ve been fixed https://github.com/aws/aws-cdk/issues/17810. To add some context, CDK added a metadata field to the Lambda Function resource. It used to look like this:
Copy code
"Metadata": {
 "aws:cdk:path": "...",
 "aws:asset:path": "...",
 "aws:asset:property": "Code"
}
And later they added a new field:
Copy code
"Metadata": {
 "aws:cdk:path": "...",
 "aws:asset:path": "...",
 "aws:asset:is-bundled": false,
 "aws:asset:property": "Code"
}
CDK thinks the Lambda function changed, and generated a new version. But since the Lambda function’s code/config didn’t really change, AWS Lambda rejected the deploy with the error
A version for this Lambda function exists
According to the GitHub issue, this should’ve been fixed.
d
Works for me, @Frank, ill let you know if I continue to see it, but we havent been working on the frontends lately.