3 months ago
Hello,
After deploying my Laravel application on Railway and linking it to the MySQL service, the deployment appears to succeed and the database connection is properly configured. However, when I try to access the application through the Railway-provided domain, I consistently get a 502 Bad Gateway error instead of the app loading.
What I’ve done so far
Deployed Laravel app with a
ProcfileLinked MySQL plugin and set environment variables (
DB_HOST,DB_PORT,DB_DATABASE,DB_USERNAME,DB_PASSWORD)Confirmed the app boots successfully in logs (
Server running on 0.0.0.0:<port>)
Cleared config and cache with php artisan config:clear
- Even the database migrations work and all tables created
Current Problem
Despite the app starting successfully, Railway shuts down the container or returns a 502 Bad Gateway when trying to open the app in the browser.
- i joined a screenshot of the application display
Attachments
3 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
3 months ago
Package operations: 0 installs, 0 updates, 35 removals
- Removing theseer/tokenizer (1.2.3)
- Removing symfony/yaml (v7.3.2)
- Removing staabm/side-effects-detector (1.0.5)
- Removing sebastian/version (5.0.2)
- Removing sebastian/type (5.1.3)
- Removing sebastian/recursion-context (6.0.3)
- Removing sebastian/object-reflector (4.0.1)
- Removing sebastian/object-enumerator (6.0.1)
- Removing sebastian/lines-of-code (3.0.1)
- Removing sebastian/global-state (7.0.2)
- Removing sebastian/exporter (6.3.0)
- Removing sebastian/environment (7.2.1)
- Removing sebastian/diff (6.0.2)
- Removing sebastian/complexity (4.0.1)
- Removing sebastian/comparator (6.3.2)
- Removing sebastian/code-unit-reverse-lookup (4.0.1)
- Removing sebastian/code-unit (3.0.3)
- Removing sebastian/cli-parser (3.0.2)
- Removing phpunit/phpunit (11.5.34)
- Removing phpunit/php-timer (7.0.1)
- Removing phpunit/php-text-template (4.0.1)
- Removing phpunit/php-invoker (5.0.1)
- Removing phpunit/php-file-iterator (5.1.0)
- Removing phpunit/php-code-coverage (11.0.10)
- Removing phar-io/version (3.2.1)
- Removing phar-io/manifest (2.0.4)
- Removing nunomaduro/collision (v8.8.2)
- Removing myclabs/deep-copy (1.13.4)
- Removing mockery/mockery (1.6.12)
- Removing laravel/sail (v1.44.0)
- Removing laravel/pint (v1.24.0)
- Removing laravel/pail (v1.2.3)
- Removing hamcrest/hamcrest-php (v2.1.1)
- Removing filp/whoops (2.18.4)
- Removing fakerphp/faker (v1.24.1)
0/25 [>---------------------------] 0%
9/25 [==========>-----------------] 36%
13/25 [==============>-------------] 52%
16/25 [=================>----------] 64%
23/25 [=========================>--] 92%
25/25 [============================] 100%
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
laravel/sanctum ....................................................... DONE
laravel/socialite ..................................................... DONE
laravel/tinker ........................................................ DONE
nesbot/carbon ......................................................... DONE
nunomaduro/termwind ................................................... DONE
56 packages you are using are looking for funding.
Use the composer fund command to find out more!
Stopping Container
INFO Nothing to migrate.
INFO Server running on [http://0.0.0.0:8080].
3 months ago
Hey! Are you running your app strictly on port 8080 or on Railways $PORT variable? I'd be interested to see if your networking is possibly pointing at the wrong port which could lead to that mismatch 