R
Railway3mo ago
zomh

Strapi Deployment "Application failed to respond"

Hello, my deployment went through and the build logs tell me the Strapi server is running. (see Screenshot) However when i hit the url in the browser it says application failed to respond. I feel like i forgot one step or something?
No description
23 Replies
Percy
Percy3mo ago
Project ID: ae636797-2246-45a3-932b-d4ac5d3c047e
zomh
zomh3mo ago
ae636797-2246-45a3-932b-d4ac5d3c047e
Solution
zomh
zomh3mo ago
No description
zomh
zomh3mo ago
already checked that page and added RAILWAY_TCP_PROXY_PORT 1337 to env variables not sure if that was the right move though can i not upload picture in here?
Brody
Brody3mo ago
yeah whats going on with these images? that is not the move at all, please read the docs page i linked or just use this server.js file https://github.com/railwayapp-templates/strapi/blob/main/config/server.js
zomh
zomh3mo ago
i read it again maybe i dont understand. it says to put the host to 0.0.0.0 and port to whatever it provides but i don't see a service variable "port". let me try one more screenshot
zomh
zomh3mo ago
No description
Brody
Brody3mo ago
^ though you seem to only be skim reading the docs page i linked
zomh
zomh3mo ago
i don't really want to use the Strapi template. I got a monorepo setup and the database is already deployed and i can connect to it form my local maschine
Brody
Brody3mo ago
you are also skim reading what im saying 🫤 i never said to use the strapi template
zomh
zomh3mo ago
let me read again
Brody
Brody3mo ago
please do ^
zomh
zomh3mo ago
okay you linked me a server.js
Brody
Brody3mo ago
indeed
zomh
zomh3mo ago
let me compare that to mine one sec
Brody
Brody3mo ago
just use this server.js file
zomh
zomh3mo ago
import type { EnvFunction } from "../types/shared/env";

export default ({ env }: { env: EnvFunction }) => ({
host: env("BACKEND_HOST", "0.0.0.0"),
port: env.int("BACKEND_PORT", 1337),
app: {
keys: env.array("BACKEND_APP_KEYS"),
},
webhooks: {
populateRelations: env.bool("BACKEND_WEBHOOKS_POPULATE_RELATIONS", false),
},
});
import type { EnvFunction } from "../types/shared/env";

export default ({ env }: { env: EnvFunction }) => ({
host: env("BACKEND_HOST", "0.0.0.0"),
port: env.int("BACKEND_PORT", 1337),
app: {
keys: env.array("BACKEND_APP_KEYS"),
},
webhooks: {
populateRelations: env.bool("BACKEND_WEBHOOKS_POPULATE_RELATIONS", false),
},
});
.env being
BACKEND_HOST=0.0.0.0 # *
BACKEND_PORT=1337 # *
BACKEND_HOST=0.0.0.0 # *
BACKEND_PORT=1337 # *
the deployment log within Railway shows me it's running on 0.0.0.0:1337 ( i can't screenshot for some reason)
To manage your project 🚀, go to the administration panel at:
http://0.0.0.0:1337/admin
To access the server ⚡️, go to:
http://0.0.0.0:1337
To manage your project 🚀, go to the administration panel at:
http://0.0.0.0:1337/admin
To access the server ⚡️, go to:
http://0.0.0.0:1337
Brody
Brody3mo ago
just use this server.js file
zomh
zomh3mo ago
Not trying to be difficult but do you see an issue with my server.js file? I can't really just change it since it's a monorepo
Brody
Brody3mo ago
yes but i would like for you to come to the conclusion as to why its wrong, for that, you need to read the docs page i linked
I can't really just change it since it's a monorepo
im sorry, i cant see how that in any way would prevent you from using the server.js file i linked
zomh
zomh3mo ago
from your linked server.js what's in URL? Is that the URL provided by Railway?
url: env('URL'),
proxy: true
url: env('URL'),
proxy: true
and the proxy is missing from mine too
zomh
zomh3mo ago
Okay i got it working. Thanks for pointing me in the right direction. With your method of helping i will not forget what i learned