Postgres + Backend
hashray9
FREEOP

a month ago

I have deployed my Postgres and backend server api. Both the deployments goes successful, but I am not able to visit my server url, it says site cannot be reached but there are no error logs and server is online. What could be the issue, I tried changing the url but it didn't help out. What could be the reason?

$10 Bounty

14 Replies

Did you make sure that the port your application is listening to is the same as the port your URL is mapped to?


Did you configure public domain / networking (like Generate Domain ) Without this, your service is only accessible internally .so , no public URL exists.This is most common issue.

 If you already have a domain generated and it still doesn't work, check:

  -> Server binds to 0.0.0.0, not localhost

  -> Using process.env.PORT (not a hardcoded port)

  -> DATABASE_URL is set correctly via Railway variable references


0x5b62656e5d

Did you make sure that the port your application is listening to is the same as the port your URL is mapped to?

hashray9
FREEOP

a month ago

let me check it out..


dharmateja

Did you configure public domain / networking (like Generate Domain ) Without this, your service is only accessible internally .so , no public URL exists.This is most common issue.If you already have a domain generated and it still doesn't work, check:-> Server binds to 0.0.0.0, not localhost-> Using process.env.PORT (not a hardcoded port)-> DATABASE_URL is set correctly via Railway variable references

hashray9
FREEOP

a month ago

yes I have generated public domain, also the server binds to 0.0.0.0


hashray9
FREEOP

a month ago

There are no errors in build logs and deploy logs. Service status shows online, but when I go to LOGS tab present in between SETTINGS and OBSERVABILITY, I see this error:

Server running on port 8080

Stopping Container

npm error path /app

npm error command failed

npm error signal SIGTERM

npm error command sh -c node dist/index.js


hashray9

There are no errors in build logs and deploy logs. Service status shows online, but when I go to LOGS tab present in between SETTINGS and OBSERVABILITY, I see this error:Server running on port 8080Stopping Containernpm error path /appnpm error command failednpm error signal SIGTERMnpm error command sh -c node dist/index.js

Try setting your server port to 3000 and the URL port to 3000.

Afterwards, access your URL through an incognito browser to avoid caching issues.


lu4p
FREETop 10% Contributor

a month ago

You may have to listen on "::" (ipv6, instead of "0.0.0.0" ipv4) for railway to work, if that doesnt help try setting "PORT=8080" on your backend container (fix if your app isn't using the PORT env variable correctly and you just want a static port).


lu4p

You may have to listen on "::" (ipv6, instead of "0.0.0.0" ipv4) for railway to work, if that doesnt help try setting "PORT=8080" on your backend container (fix if your app isn't using the PORT env variable correctly and you just want a static port).

OP literally said they're binding to v4, not v6.


lu4p

You may have to listen on "::" (ipv6, instead of "0.0.0.0" ipv4) for railway to work, if that doesnt help try setting "PORT=8080" on your backend container (fix if your app isn't using the PORT env variable correctly and you just want a static port).

hashray9
FREEOP

a month ago

i changed code to listen on "::" but it did not work out.
npm warn config production Use --omit=dev instead.<-- this is the matter of concern?

Starting Container

> node dist/index.js

Server running on port 8080

npm warn config production Use --omit=dev instead.

Stopping Container

npm error path /app

npm error command failed

npm error signal SIGTERM

npm error command sh -c node dist/index.js


0x5b62656e5d

Try setting your server port to 3000 and the URL port to 3000.Afterwards, access your URL through an incognito browser to avoid caching issues.

hashray9
FREEOP

a month ago

port is auto injected. As this issue comes in my wat I tried to deploy server on Render and it worked perfectly fine. I do not know what is the matter in here....


hashray9
FREEOP

a month ago

I think the issue is with DNS, when i looked up to domain name generated by railway, DNS query failed


hashray9

i changed code to listen on "::" but it did not work out. npm warn config production Use --omit=dev instead.<-- this is the matter of concern?Starting Container> node dist/index.jsServer running on port 8080npm warn config production Use --omit=dev instead.Stopping Containernpm error path /appnpm error command failednpm error signal SIGTERMnpm error command sh -c node dist/index.js

Railway does not support v6 public networking.


hashray9

port is auto injected. As this issue comes in my wat I tried to deploy server on Render and it worked perfectly fine. I do not know what is the matter in here....

Have you tried manually overriding port?


0x5b62656e5d

Have you tried manually overriding port?

hashray9
FREEOP

a month ago

yes, i tried but it didn't work


Loading...