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

Hotswap CLI flag breaks first deploy #78

Closed bounds closed 1 year ago

bounds commented 1 year ago

Added in commit https://github.com/sladg/nextjs-lambda/commit/fd1e1da6d66107bf7fc0f5e7949b627be36ecc93

Hotswap results in first time deployments breaking

stderr: Stack Deployments Failed: Error: No stack named 'StandaloneNextjsStack-Temporary'

Process failed with error: Error: Command failed: /Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/bin/cdk deploy --app "node /Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/@sladg/nextjs-lambda/dist/cdk/app.js" --require-approval never --ci --hotswap

 ❌  StandaloneNextjsStack-Temporary failed: Error: No stack named 'StandaloneNextjsStack-Temporary'
    at CloudFormationStack.assertExists (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:329:591559)
    at CloudFormationStack.get stackId [as stackId] (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:329:590784)
    at tryHotswapDeployment (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:329:598568)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async deployStack (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:335:651)
    at async deployStack2 (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:342:144797)
    at async /Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:342:130251
    at async run (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:342:128257)

 ❌ Deployment failed: Error: Stack Deployments Failed: Error: No stack named 'StandaloneNextjsStack-Temporary'
    at deployStacks (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:342:130558)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async CdkToolkit.deploy (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:342:146846)
    at async exec4 (/Users/dave/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/index.js:397:51795)
Stack Deployments Failed: Error: No stack named 'StandaloneNextjsStack-Temporary'
bounds commented 1 year ago

Workaround is to use 6.1.2 for initial deploy

sladg commented 1 year ago

Closing :) Hotswap turned off by default, flag added to turn on if wanted.