NextJS Error: Application error: a server-side exception

joselvelez
PRO

2 months ago

I am getting this error in my nextjs application. I am not seeing enough information to understand what is going on.

I see this: Application error: a server-side exception has occurred while loading (see the server logs for more information).

Digest: 2164805080

Railway Log: https://railway.com/project/c02ff7c5-4da1-47a0-b48b-9e7302c57864/logs?environmentId=ddb9fdf5-000d-4991-bdcb-c1ba7fac7d6b&filter=%40deployment%3A99f00b2d-615d-4ce5-8c86-25b3f2116eae+-%40replica%3A2e807450-5e0a-485f-802d-0a2b15a80882&context=2025-06-27T15%3A03%3A40.402682070Z

Attachments

Solved$5 Bounty

26 Replies

2 months ago

Apologies but this looks like an issue with the application level code. Due to volume, we can only answer platform level issues.

I've made this thread public so that the community might be able to help with you query.


Status changed to Awaiting User Response Railway 2 months ago


joselvelez
PRO

2 months ago

I understand, but if I had visibility of the logging, I could fix it. The railway logs are not helful.


Status changed to Awaiting Railway Response Railway 2 months ago


joselvelez
PRO

2 months ago

This is not giving me enough to find the issue. How do I get more visibility in the logs?

Attachments


2 months ago

These logs are coming from your app, not railway. you'll want to add more logs on your end to figure the error out.


Status changed to Awaiting User Response Railway 2 months ago


sim
FREE

2 months ago

Try to add several logs at different places when your application starts or where the code is that is producing these logs


sim
FREE

2 months ago

They have a good start up guide on NextJs may help you out https://docs.railway.com/quick-start#deploying-your-project---with-the-cli


joselvelez
PRO

2 months ago

Thanks @sim, but the issue is with the internal networking. The app is working fine. it works fine on localhost and it works find on railway when I use the public address for the api server, but I need the internal one to work so I dont get hit with egress fees.

I've had nothing but positive things to say about railway so far and have been steadily moving more to the platform, but this issue with internal vs public has been the most frustrating experience so far.


2 months ago

Hello,

Please see our guide on the private network -

https://docs.railway.com/guides/private-networking#communicating-over-the-private-network

Best,
Brody


joselvelez
PRO

2 months ago

You guys keep copy + pasting this doc, but it is not helping me. I've already tried with no success.


joselvelez

You guys keep copy + pasting this doc, but it is not helping me. I've already tried with no success.

smolpaw
HOBBYTop 10% Contributor

2 months ago

It's because the logs you posted is not at all helpful. The actual referenced js file in the stack trace is just a minified file which even in itself isn't helpful when reviewed
So there is actually no meaningful information you have provided other than "an error has occurred".

If you want help then you need to provide more information about your app and in this case you entire app because with the limited info provided i don't even know what to ask
Add me to your github repo or make it public and post it here so we can review and suggest solutions.


smolpaw

It's because the logs you posted is not at all helpful. The actual referenced js file in the stack trace is just a minified file which even in itself isn't helpful when reviewedSo there is actually no meaningful information you have provided other than "an error has occurred".If you want help then you need to provide more information about your app and in this case you entire app because with the limited info provided i don't even know what to askAdd me to your github repo or make it public and post it here so we can review and suggest solutions.

joselvelez
PRO

2 months ago

Yes, I agree, the initial logs I provided were not enough. I've been able to isolate it the issue to the private networking settings - which I am not getting any help from railway support except for them copy + pasting the link to their docs.


2 months ago

Is the service you are trying to fetch listening on IPv6?

Are you using http:// in the URL you are trying to fetch?

Are you specifying the port in the URL you are trying to fetch? (the private port such as 8080 or 3000)


joselvelez
PRO

2 months ago

I have a nestjs application running in my project.


I am trying to get my nextjs application (different service in the same railway project) to access the the nestjs application using the internal networking.

Ive tried setting my env variable in railway for the nextjs application to:
- gridlq
- http://gridlq
- http://gridlq.railway.internal

none of these are working. Do i need to specify port as well?

when i set the env variable to the public address, it works fine.

Attachments


joselvelez

I have a nestjs application running in my project. I am trying to get my nextjs application (different service in the same railway project) to access the the nestjs application using the internal networking. Ive tried setting my env variable in railway for the nextjs application to:- gridlq- http://gridlq- http://gridlq.railway.internalnone of these are working. Do i need to specify port as well? when i set the env variable to the public address, it works fine.

smolpaw
HOBBYTop 10% Contributor

2 months ago

Yes, when using internal networks you need to specify the port as well.
The public endpoint works because it is configured with the port already, private endpoint isn't
So it would be something like http://gridlq.railway.internal:3000


joselvelez
PRO

2 months ago

Thanks,

I tried this and still not working. Works fine with public address, but private one just wont work.

NestJS Application (Same railway project)

NextJS Application (same railway project)


2 months ago

gridlq.railway.internal is not listening on port 3000, it is listening on port 8080.


brody

gridlq.railway.internal is not listening on port 3000, it is listening on port 8080.

joselvelez
PRO

2 months ago

Where am I supposed to see that setting?

My nestjs app defaults to port 3000 if no port is specified in the env file.

  const port = process.env.PORT ?? 3000;
  await app.listen(port, '::');

joselvelez

Where am I supposed to see that setting?My nestjs app defaults to port 3000 if no port is specified in the env file.const port = process.env.PORT ?? 3000; await app.listen(port, '::');

smolpaw
HOBBYTop 10% Contributor

2 months ago

If you are able to access your nestjs api on public url then check your railway deployment for public endpoint and see if it's listening on port 3000 or 8080. You can do this by going into your nestjs app -> Settings -> Networking, then click the edit button and check what port is being used. If it's other than 3000 then use that port for the internal url


joselvelez
PRO

2 months ago

I did that. There is no information on port there.

Attachments


joselvelez

I did that. There is no information on port there.

smolpaw
HOBBYTop 10% Contributor

2 months ago

That's the private networking section. I talked about public networking, you will find the port there


joselvelez
PRO

2 months ago

Ok, that is confusing because I am trying to use the internal network, not the public. Are you saying that both use the same port and I can reference the public to know what the private one is using?


smolpaw
HOBBYTop 10% Contributor

2 months ago

I am assuming you got the port wrong. So if the public endpoint is working then check what port the public endpoint is using then use that for the private endpoint


smolpaw
HOBBYTop 10% Contributor

2 months ago

in your nextjs env variable


joselvelez
PRO

2 months ago

That worked. Thank you! The fix was getting the port from the public networking.


smolpaw
HOBBYTop 10% Contributor

2 months ago

just curious, what was it set to, 8080 ?


joselvelez
PRO

2 months ago

yes, it was using the magic port. I think they should add better visibility on this information.


Status changed to Solved uxuz 2 months ago