Railway adding semicolon to Django CORS_ALLOWED_ORIGINS list
leonti98
FREEOP

9 months ago

in my settings.py
CORS_ALLOWED_ORIGINS = ["https://hybre-front-production.up.railway.app"]
print("CORS_ALLOWED_ORIGINS", CORS_ALLOWED_ORIGINS)

in deploy logs
CORS_ALLOWED_ORIGINS ['https://hybre-front-production.up.railway.app';]

running locally
CORS_ALLOWED_ORIGINS ['https://hybre-front-production.up.railway.app']

I was using environment variables on railway and getting this issue. I hard coded link to make sure it's not because of environment variables and I'm still getting same result, list with semicolon before ]. can somebody explain what is going on? and how to fix this issue?

Solved

4 Replies

brody
EMPLOYEE

9 months ago

Hello,

We do not modify variables in anyway, this would be an issue with your code.

Unfortunately, we are not able to provide coding support here as we can only offer platform or product support.

Best,
Brody


Status changed to Awaiting User Response Railway 9 months ago


brody

Hello,We do not modify variables in anyway, this would be an issue with your code.Unfortunately, we are not able to provide coding support here as we can only offer platform or product support.Best,Brody

mjablonski
PRO

9 months ago

It seems to be an issue with the Railway logging when a full URL is logged, but it does no harm to the application...

If I just do a console.log via Node.js like

console.log(["https://www.jeasx.dev"]);

it ends up like this in the Railway deploy logs:

[ 'https://www.jeasx.dev'; ]


Status changed to Awaiting Railway Response Railway 9 months ago


brody

Hello,We do not modify variables in anyway, this would be an issue with your code.Unfortunately, we are not able to provide coding support here as we can only offer platform or product support.Best,Brody

leonti98
FREEOP

9 months ago

Hello Brody, I understand why you think it's a code issue that's what I thought but I have tried everything and now URL is literally hard coded and it does not happen when running locally only when deploying. You can check github repository and branch which I'm deploying from and it's CORS_ALLOWED_ORIGINS = ["https://hybre-front-production.up.railway.app"] but in when printing in deploy logs it shows ['https://hybre-front-production.up.railway.app';], I can not find any other explanation than something happening on railway because everything else else I already tried and checked. It is correct branch and there is no semicolon, so something is happening on your side when deploying. I understand how strange it sounds but it's changing somewhere between github and railway deployment.


mjablonski

It seems to be an issue with the Railway logging when a full URL is logged, but it does no harm to the application... If I just do a console.log via Node.js likeconsole.log(["https://www.jeasx.dev"]);it ends up like this in the Railway deploy logs:[ 'https://www.jeasx.dev'; ]

leonti98
FREEOP

9 months ago

Oh, thank you so much. I thought I was going crazy. so it will not affect the way python interprets it is just logging issue.


Status changed to Solved leonti98 9 months ago


Loading...