About two hours ago, I successfully deployed version 37 of my project. After that, I continued working and added a new function to the app, which created version 38. However, when I attempted to deploy this new version, I suddenly started encountering a build error.
The build log shows the following message:
⨯ Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error
> Build error occurred
ReferenceError: Cannot access 'userConfig' before initialization
at mergeConfig (next.config.mjs:29:3)
at <unknown> (next.config.mjs:26:1)
error: script "build" exited with code 1
Error: Command "bun run build" exited with 1
I’m not sure what changed exactly, as the only modification I made was adding a new function in my app’s logic—not in the configuration file. Everything was working fine before that.
To troubleshoot, I deleted version 38 and tried to redeploy version 37, which had previously deployed successfully. However, now version 37 is also failing with the exact same error, even though I hadn’t modified anything in that version.
I’d really appreciate any help figuring out what might be going on here or how I can fix it.
https://v0.dev/chat/fork-of-funcional-mas-reciente-24-mar-25-pero-no-h-7Wf26u4eY65
I also noticed something that might be related to the issue.
The error message refers to a file named next.config.mjs, but in my project, I’ve always used the standard next.config.js file (with the .js extension, not .mjs). I haven’t created or renamed any config file recently, and my project has been working fine with next.config.js until now.
It’s strange that the build process is now trying to load next.config.mjs, which doesn’t even exist in my project directory. This might be part of the issue or at least related to the sudden deployment failures.
