10 months ago
When Deploying my application was completed , I open the link to (https://amusing-adaptation-production.up.railway.app/) but it is a bad gateway 502.
Can someone help solve this problem ?
51 Replies
Can you type N/A or your project ID
Else this will be closed automatically by @Percy
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/5d5e3f28-b1ae-4059-8080-89521d502fdb/vol_tjr5lr8ublg0xs8w
Starting Container
2025-05-05 08:09:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.3.0-1.el9 started.
2025-05-05 08:09:27+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2025-05-05 08:09:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.3.0-1.el9 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2025-05-05T08:09:28.650305Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-05-05T08:09:28.786758Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.3.0) starting as process 1
2025-05-05T08:09:28.794878Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-05-05T08:09:29.949931Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-05-05T08:09:31.016432Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-05-05T08:09:31.016487Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-05-05T08:09:31.022240Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2025-05-05T08:09:31.065971Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2025-05-05T08:09:31.066089Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.3.0' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
The root of your crash: An infinite restart loop
Your app is repeatedly restarting:
Starting FashionWebApplication v0.0.1-SNAPSHOT using Java 17.0.7 with PID 1 ...
This exact log appears twice within ~30 seconds, and nothing indicates clean shutdown or startup success. That means:
Your Spring Boot app starts, logs a bunch of info, Then crashes silently.
Railway restarts it automatically, which creates the illusion of a "crash loop" with no obvious error.
.
To debug you can…
Set logging.level.root=DEBUG in your application.properties
Add --debug to your Spring Boot startup command
This means…
Set server.port=${PORT} in your application.properties
Double-check DB connection values (use Railway's environment variables)
Enable debug logging for more output:
logging.level.root=DEBUG
spring.main.banner-mode=log
If possible, run the .jar locally with the same environment to reproduce the crash.
Does this make sense? Or do you need clarification?
If it doesn't work you can message back!
@OctoCubee I still encounter this error even though I have set server.port=${8080} and logging.level.root=DEBUG spring.main.banner-mode=log

The message that shows up means that there's an issue in your code on deploy. Do you have any code that could be causing this?
You might need to add logging in your code for deploy so we can workout what the issue is
Im not too sure sorry, you need to add logging and look through your code to see where it could crash
I don't have any detail on what language you're using and other things
I use java with spring boot and html, css and js and also I store pics on cloudinary
okay, to log you can do > System.out.println("This is a log message.");
I would say to use the generated domain rather than TCP, so yes probably some sort of error xD
spring.application.name=Fashion_Web
server.port=${PORT:8080}
Railway database
spring.datasource.url=jdbc:mariadb://turntable.proxy.rlwy.net:59479/railway?useSSL=false
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.mvc.view.prefix=classpath:/templates/
spring.mvc.view.suffix=.html
Bạn có thể giữ lại cấu hình database local (đã comment) để dễ dàng chuyển đổi khi cần
#Local database
spring.datasource.url=jdbc:mariadb://localhost:3306/fashionshop?useSSL=false
spring.messages.encoding=UTF-8
server.servlet.encoding.force=true
server.servlet.encoding.charset=UTF-8
logging.level.org.hibernate.SQL=debug
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=trace
Chat bot api
gemini.api.key=
qdrant.url=http://localhost:6333
Cloudinary api
cloudinary.cloudname=dgtfqxgvx cloudinary.apikey=
cloudinary.api_secret=
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
C?u hình Elasticsearch
spring.elasticsearch.rest.uris=https://my-elasticsearch-project-ada03b.es.us-east-1.aws.elastic.cloud:443
spring.elasticsearch.rest.username= # N?u Elasticsearch có authentication
logging.level.root=DEBUG
spring.main.banner-mode=log
here is my application.properties
spring.datasource.url=jdbc:mariadb://turntable.proxy.rlwy.net:59479/railway?useSSL=false
Railway uses SSL by itself
Your application.properties file is mostly correct, but to make it more secure and flexible, you should move sensitive information like database passwords and API keys to environment variables, ensure only one database configuration is active at a time (comment the other), and consider using separate configuration profiles (e.g., application-dev.properties and application-prod.properties) to easily switch between local and production environments.
Mysql isnt that well known to me, so you can always use AI to debug and hopefully fix it :)
@OctoCubee Once again, thanks for your help <:salute:1137099685417451530> . Last night I deployed it successfully.
10 months ago
thanks @OctoCubee <:salute:1137099685417451530>




