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:
However, when its built on my production server, it seems to only lint (even though it is still running next build
) with this output:
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
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.