Application Error, app not listening on $PORT?

i uploaded an app with the railway cli and setted the env variable called PORT, but it's still broken..
38 Replies
Neto
Neto2y ago
what start command have you used? because it needs the port like next start -p $PORT
samuele
samuele2y ago
it's a lavavel application
Neto
Neto2y ago
have you set the port on .env? just did a small instance https://laravel-production-f233.up.railway.app/ SERVER_PORT=${PORT} on the env variables
samuele
samuele2y ago
it must be SERVER_PORT=${PORT}?
Neto
Neto2y ago
ye the ${PORT} is set by railway itself
samuele
samuele2y ago
i written on the .env vars PORT=${PORT}
Neto
Neto2y ago
its SERVER_PORT laravel
samuele
samuele2y ago
oh ok SERVER_PORT=8000 it's ok?
Neto
Neto2y ago
railway defines the port for the most part SERVER_PORT=${PORT} is the config on .env and thats it
samuele
samuele2y ago
how does it start tho? with a cmd? or in auto?
Neto
Neto2y ago
nixpacks
Neto
Neto2y ago
on deploy logs they show the port
Neto
Neto2y ago
but you dont define directly with suck as 7078 is the pipeline running? deploying*
samuele
samuele2y ago
samuele
samuele2y ago
yeah
Neto
Neto2y ago
check deploy logs and have you set the other env variables?
samuele
samuele2y ago
yeah wait you mean the one the i use there are others env vars to make railway service works?
Neto
Neto2y ago
like
Neto
Neto2y ago
i just did copy from the local .env put APP_ENV=production and SERVER_PORT=${PORT} and was working
samuele
samuele2y ago
samuele
samuele2y ago
wait i had the app_env on local maybe that's it
samuele
samuele2y ago
noup
Neto
Neto2y ago
there was any log on build logs? before the
samuele
samuele2y ago
oh wait
Neto
Neto2y ago

================
Publishing Image
================

================
Publishing Image
================
samuele
samuele2y ago
do you have a dockerfile?
Neto
Neto2y ago
i did their default template
samuele
samuele2y ago
mhhh can u link me the github repo? nvm i found it
Neto
Neto2y ago
with adding a new service you can spawn a new one
samuele
samuele2y ago
i dont have the same structure tho
Neto
Neto2y ago
adds a database and laravel if you can run locally with docker should work fine on railway
samuele
samuele2y ago
i run it locally only using the cmd php artisan serve not the dockerfile
Neto
Neto2y ago
you should check the build logs maybe there is a clue there
samuele
samuele2y ago
on the template that they have i dont find the DockerFile i use the docker-compose that it's not usable on railway... do u know hot to convert it to a DockerFile?
Neto
Neto2y ago
usually laravel uses sail
Neto
Neto2y ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Neto
Neto2y ago
im not the biggest fan from the framework if the issue is railway relatedf you can maybe get more help from their discord server
Want results from more Discord servers?
Add your server