next.jsplesk

Static files not accessible - NextJS Plesk .js/.css extension changed to .jsundefined/.cssundefined


I've a NextJS app deployed on Plesk server. It was working properly, I changed something in layout and pushed an update, since then, neither the new nor the backup is working.

The error states that the static files (JS and CSS) files are not available and gives a 404 error. The reason for this error is it's adding undefined at the end of all the URLs and I've no clue where is it coming from, I've found nothing similar to this one. Because of this, all CSS and JS files' extensions have changed to .cssundefined and .jsundefined, removing the undefined from the url works and the file's content opens in the browser.

I've been using the command next build and it was working with the same config properly. Also, the changes were only in a layout file, related to only few layout elements.

The same code is working properly at localhost, in both development and production mode.

You can find the issue I've filed on NextJS's Github repo here.

enter image description here

enter image description here


Solution

  • The issue is related to NextJS's versions 13.2.4 and 13.2.5 and not related to my code.

    After filing a discussion thread on the official repository of NextJS, the solution provided is to downgrade and lock your NextJS version to 13.2.1 in your package.json file.

    You can find the solution provided here.

    enter image description here

    PS: They're expecting a bug wave for this.