[NextJS] Static Build files are not found

shankytiwariTRIAL

9 months ago

I have deployed my Next JS application Railway, the application is loading but few build files are not found for some reason.

Please refer below Image:

Note: The same application is working perfectly working file in Vercel.

Any idea whats wrong here ?

Solved

26 Replies

9 months ago

Hi Shashank,

It looks like your build completed and this got resolved? If you're still experiencing issues, please provide a link a deployment where you're experiencing this and we can investigate.

Regards, Christian


Status changed to Awaiting User Response railway[bot] 9 months ago


shankytiwariTRIAL

9 months ago

Hey christian, The build is completed but the issue is still there. I can't share the URL here at public forum unfortunately!


Status changed to Awaiting Railway Response railway[bot] 9 months ago


9 months ago

Is next build being ran during build?


Status changed to Awaiting User Response christian 9 months ago


shankytiwariTRIAL

9 months ago

It ran properly, I did not see any error in the Build Logs


Status changed to Awaiting Railway Response railway[bot] 9 months ago


shankytiwariTRIAL

9 months ago

Most of the pages are working/loading perfectly fine, its just the one page where some build files are missing it seems!


9 months ago

What is your build script?


shankytiwariTRIAL

9 months ago

Its a very simple setup, here is my next.config.js and package.json,

  1. next.config.js:

    // next.config.js
    
    module.exports = {
      reactStrictMode: false,
      env: {
        API_BASE_URL: process.env.API_BASE_URL,
      },
    
      images: {
        unoptimized: true,
        domains: [
          "api.example.com",
        ],
      },
    };
  1. package.json:

    {
      "name": "some_app",
      "version": "0.1.0",
      "private": true,
      "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint"
      },
      "dependencies": {},
      "devDependencies": {}
    }

    Any extra config you need ?


9 months ago

What version of node is the build using and what version do you use locally?


shankytiwariTRIAL

9 months ago

Local:

  1. NodeJS Version: v20.10.0

  2. NextJS Version: 14.0.4

Railway:

  1. NodeJS Version: nodejs_18 (18)

  2. NextJS Version: 14.0.4


9 months ago

Try setting engines.node to 20


shankytiwariTRIAL

9 months ago

Trying give me few mins!


shankytiwariTRIAL

9 months ago

Sorry, where I do I add this setting ?


9 months ago

package.json


shankytiwariTRIAL

9 months ago

oh that, okay trying


shankytiwariTRIAL

9 months ago

Build is in progress


9 months ago

Is it now using node 20?


shankytiwariTRIAL

9 months ago

Yes, I can see node_20 refer below image


shankytiwariTRIAL

9 months ago

It is taking more than usual !


9 months ago

What is? the build or the deploy?


shankytiwariTRIAL

9 months ago

Okay, now its deployment is comepleted. But the same issue still there where most of the pages are working/loading perfectly fine, its just the one page where some build files are missing.


9 months ago

Have you tried researching the issue? this wouldn't be isolated to Railway.


shankytiwariTRIAL

9 months ago

I tried same thing in Vercel it worked there, hence I created a thread here. Thought you guys might have seem something similar to this before!

May be I can create build files locally and serve them via static server just to see if the build files are getting created in the first places!

Let me try and get back


9 months ago

Vercel develops next, I'm sure they have many workarounds for many misconfigurations so your apps always just work on their platform, but Railway only runs your project as-is, thats why I suggested researching the error.


shankytiwariTRIAL

9 months ago

Makes sense, let me try


Status changed to Awaiting User Response christian 9 months ago


shankytiwariTRIAL

7 months ago

This ticket can be closed


Status changed to Awaiting Railway Response railway[bot] 7 months ago


7 months ago

Thank you for the update. We'll close the thread.


Status changed to Awaiting User Response railway[bot] 7 months ago


Status changed to Solved christian 7 months ago