Next Build Works Locally, But Not on Server

Running yarn build (i.e. next build) locally successfully creates the optimised build, with the following output:
info - Linting and checking validity of types...
info - Creating an optimized production build...

🌼 daisyUI components 2.33.0 https://github.com/saadeghi/daisyui
✔︎ Including: base, components, themes[1], utilities

info - Compiled successfully
info - Collecting page data...
info - Generating static pages (0/12)
info - Generating static pages (3/12)
info - Generating static pages (6/12)
info - Generating static pages (9/12)
info - Generating static pages (12/12)
info - Finalizing page optimization...
Done in ...
info - Linting and checking validity of types...
info - Creating an optimized production build...

🌼 daisyUI components 2.33.0 https://github.com/saadeghi/daisyui
✔︎ Including: base, components, themes[1], utilities

info - Compiled successfully
info - Collecting page data...
info - Generating static pages (0/12)
info - Generating static pages (3/12)
info - Generating static pages (6/12)
info - Generating static pages (9/12)
info - Generating static pages (12/12)
info - Finalizing page optimization...
Done in ...
However, when its built on my production server, it seems to only lint (even though it is still running next build) with this output:
info - Linting and checking validity of types...
Done in 110.69s.
info - Linting and checking validity of types...
Done in 110.69s.
I don't get this problem on previous versions of my code, and I'm wondering if somehow the build is silently failing?
1 Reply
ed.upton
ed.uptonOP•2y ago
After many hours debugging, I've found the cause and the solution: It seems that the aws-sdk NPM package is breaking deployment silently somehow, with a potential similar/equivalent problem mentioned in this post https://stackoverflow.com/questions/75107933/aws-sdk-contributes-to-build-error-uncaught-typeerror-e-is-not-a-constructor. The solution is to move to v3 of the JavaScript AWS SDK (https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html), which I have confirmed does not have the same issue when building.
Want results from more Discord servers?
Add your server