a month ago
I'm having a persistent production deployment issue with my Spring Boot application on Railway. Please investigate the actual deployment and runtime configuration to identify the root cause. Do not just suggest regenerating the secret, re-adding variables, or redeploying without evidence.
Project: perfect-perception
Environment: production
Service: milk-web
Production URL: https://milk-web-production.up.railway.app/
Repository: https://github.com/Arvee005/milk-web
Latest known commit: 36ed61e24374240cd02557bae136b90f9a503577
Error
The application repeatedly crashes during startup with:
java.lang.IllegalStateException: MILKWEB_JWT_SECRET is not configured. The placeholder '${MILKWEB_JWT_SECRET}' was not resolved. Ensure the environment variable is set in the deployment environment.
What has already been verified
MILKWEB_JWT_SECRETexists in the Railway service's Variables page and contains a non-empty, actual secret value.SPRING_PROFILES_ACTIVEis set toprod.- The secret was replaced after the previous value was accidentally exposed, and the application was redeployed.
- Railway reports a successful deployment, but the application continues to crash with the same error.
- The Railway dashboard does not provide a Console option for this service.
- Please do not request that I share the secret value.
Relevant application configuration
backend/src/main/resources/application.properties contains:
milkweb.jwt.secret=${MILKWEB_JWT_SECRET}
backend/src/main/resources/application-prod.properties contains the production database configuration and is intended to load when the prod profile is active.
The application uses @ConfigurationPropertiesScan in MilkWebBackendApplication, and JwtProperties binds the milkweb.jwt properties. JwtService throws the reported exception when it receives the literal unresolved placeholder.
The backend uses a Dockerfile build based on Maven and Eclipse Temurin Java 21. Railway is configured to use backend/Dockerfile through backend/railway.json.
Please investigate these specific possibilities
- Inspect the actual running deployment, including its deployment ID, commit SHA, build logs, runtime logs, start command, and configured root directory/Dockerfile path. Confirm that the deployed artifact corresponds to the latest expected commit.
- Verify whether
MILKWEB_JWT_SECRETis actually available inside the running service's JVM/container environment. Report only whether it is present and non-empty—never reveal or print its value. - Check whether the variable is scoped to the correct service and production environment and whether any environment configuration or deployment setting prevents it from reaching the container.
- Inspect the packaged JAR and effective Spring configuration to determine why
${MILKWEB_JWT_SECRET}reachesJwtServiceliterally instead of resolving. - Check for duplicate configuration files, unexpected property sources, incorrect build context, stale artifacts, or a mismatch between the configured Dockerfile path and the actual build.
- Identify the specific root cause, then recommend the smallest targeted fix.
Please distinguish facts confirmed by deployment inspection from hypotheses. If you cannot access the runtime environment or secret-presence metadata, state that limitation and give me the exact next diagnostic needed.
Important: Do not print, expose, or ask me to paste any secret or credential. Do not make destructive changes, rotate credentials again, or modify production settings without explaining the proposed change and getting my approval first.
1 Reply
a month ago
We checked the committed configuration of the milk-web service in the production environment, and it has no service variables at all, so MILKWEB_JWT_SECRET and SPRING_PROFILES_ACTIVE are not being passed to the running container. That explains why Spring receives the placeholder unresolved. The environment also has no pending staged changes, so the variables are not waiting on an unapplied change.
The service is deploying from commit 36ed61e on main with root directory /backend, and it builds with Railpack rather than backend/Dockerfile, so the railway.json setting is not taking effect for this build either.
The smallest fix is to add MILKWEB_JWT_SECRET and SPRING_PROFILES_ACTIVE directly on the milk-web service while the production environment is selected, then apply the change so a new deployment picks them up. If the values you see were added on a different service, in a different environment, or as shared variables, they will not reach milk-web unless they are set or referenced on this service in production.
Status changed to Awaiting User Response Railway • about 1 month ago
a month ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • about 1 month ago