jetbridge / cdk-nextjs

Deploy a NextJS application using AWS CDK
https://constructs.dev/packages/cdk-nextjs-standalone
Apache License 2.0
273 stars 45 forks source link

Fix: Usage with PNPM on Windows #183

Open bestickley opened 10 months ago

bestickley commented 10 months ago

Problem

When using cdk-nextjs with PNPM on windows, the deployment succeeds but server fails with 500 because it cannot find "next" package. This is because PNPM uses symlinks and the during deployment, cdk-nextjs uses Compress-Archive powershell commandlet which doesn't support symlinks.

Solution

Use fs.cpSync with dereference: true to get rid of symlinks and copy to a temporary location. Then use built in CDK Asset construct to upload.