The service stopped retrieving variables and started loading the appsetting.json file instead.
luizgodoy
HOBBYOP

2 months ago

After an update, a service started ignoring application variables and instead retrieved them from the appsettings.json file, causing an error when trying to connect to YOUR_DOMAIN_NAME. I couldn't find any documentation that helps resolve this via the dashboard or CLI.

I'll attach images below.

Solved$10 Bounty

Pinned Solution

domehane
FREE

2 months ago

Hello , your appsettings.json still has the placeholder values like YOUR_DATABASE and YOUR_POSTGRES_HOST and your railway env vars are not overriding them. for asp.net core to override appsettings.json with env vars, the variable name has to exactly match the config key in appsettings.json using double underscore __ as separator. so check what keys are inside your appsettings.json and rename your railway variables to match them exactly

Hope this help you :)

2 Replies

Status changed to Awaiting Railway Response Railway 2 months ago


luizgodoy
HOBBYOP

2 months ago

Image with values from "railway variable" x "service log"!


Status changed to Open Railway 2 months ago


domehane
FREE

2 months ago

Hello , your appsettings.json still has the placeholder values like YOUR_DATABASE and YOUR_POSTGRES_HOST and your railway env vars are not overriding them. for asp.net core to override appsettings.json with env vars, the variable name has to exactly match the config key in appsettings.json using double underscore __ as separator. so check what keys are inside your appsettings.json and rename your railway variables to match them exactly

Hope this help you :)


Status changed to Solved brody about 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...