a year ago
Hey all, I would like to know if what I'm trying to do it's possible.
I deployed my repo on railway and the variables are stored in the .env file. During the workflow, the user could generate a OAUTH TOKEN, and at that point I would like that the generated token (which is successfully already generated) substitute the old value of the OAUTH TOKEN variable in the .env file and the whole project is redeployed with the new variable
this is the error in the logs at the moment:
INFO:root:Successfully generated new token
ERROR:root:Error updating Railway environment: 400 Client Error: Bad Request for url: https://backboard.railway.com/graphql/v2
Is that feasible? I already know that probably the new token won't be stored in the repo, just during the session
13 Replies
a year ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • about 1 year ago
a year ago
Firstly, can you help me to understand why you are storing secrets in an .env file in your repo? generally that horrible practice.
brody
Firstly, can you help me to understand why you are storing secrets in an .env file in your repo? generally that horrible practice.
a year ago
I know it's not the best, btw I started coding the projct using a previous template and at the moment I'm fine with the variables stored on my private repo. Do I necessarily need to store the variables in the related section of the dashboard to can upload a specific variable and redeploy the project?
a year ago
You would want to exclusively use the dashboard to save your variables for the service -
https://docs.railway.com/overview/the-basics#service-variables
Please remove the .env file from the repo, it's still bad practice for private repos.
brody
You would want to exclusively use the dashboard to save your variables for the service -https://docs.railway.com/overview/the-basics#service-variablesPlease remove the .env file from the repo, it's still bad practice for private repos.
a year ago
ok, thank you. After saving the variables in the dashboard, could I figure out on what I want to achieve?
a year ago
Please make sure the .env file is removed from GitHub and added to your .gitignore
brody
Please make sure the .env file is removed from GitHub and added to your .gitignore
a year ago
done! now what should I do?
a year ago
What else is there to do?
You have your variables as service variables now, and you no longer have an .env file in your repo.
All looks good to me.
brody
What else is there to do?You have your variables as service variables now, and you no longer have an .env file in your repo.All looks good to me.
a year ago
I'm not figuring out on automatically substituting a variable and then deploy again the project
By the way, please help me regarding this new issue I'm noticing. I'm running the same exact code that was running properly few days ago, but now everytime there are these errors in the logs, that before weren't showed:
[2025-01-06 19:55:38 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:12)
[2025-01-06 19:55:38 +0000] [12] [INFO] Worker exiting (pid: 12)
[2025-01-06 19:55:38 +0000] [1] [ERROR] Worker (pid:12) exited with code 1
[2025-01-06 19:55:38 +0000] [1] [ERROR] Worker (pid:12) exited with code 1.
[2025-01-06 19:55:38 +0000] [14] [INFO] Booting worker with pid: 14
---
The code is literally the same of when the project was running properly. Could be a reason that I have too much deployed projects on railway for my account?
a year ago
Oh are you trying to call the Railway API to update a variable? I don't think you mentioned you wanted to use the API.
Why do you need to update the variable on Railway? seems like an X Y problem.
brody
Oh are you trying to call the Railway API to update a variable? I don't think you mentioned you wanted to use the API.Why do you need to update the variable on Railway? seems like an X Y problem.
a year ago
I need it because the OAUTH TOKEN sometimes expires, so with this procedure I can substitute the old token with the new one in an automatic way.
But regarding this error:
[2025-01-06 19:55:38 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:12)
[2025-01-06 19:55:38 +0000] [12] [INFO] Worker exiting (pid: 12)
[2025-01-06 19:55:38 +0000] [1] [ERROR] Worker (pid:12) exited with code 1
[2025-01-06 19:55:38 +0000] [1] [ERROR] Worker (pid:12) exited with code 1.
[2025-01-06 19:55:38 +0000] [14] [INFO] Booting worker with pid: 14
---
What do you think? I'm running literally the same code that was working properly days ago, and I never had this error. At the moment in my account there are 7 projects deployed, could be that the reason?
a year ago
OAUTH for WhatsApp?
WORKER TIMEOUT timeout means a worker took longer than 30 seconds to complete, likely meaning an incoming http request took longer than 30 seconds.
There's also no variables on that service anymore, where did they all go?
brody
OAUTH for WhatsApp?WORKER TIMEOUT timeout means a worker took longer than 30 seconds to complete, likely meaning an incoming http request took longer than 30 seconds.There's also no variables on that service anymore, where did they all go?
a year ago
OAUTH for google cloud, GOOGLE OAUTH TOKEN
there are no variables on the service at the moment, because trying to understand the issue, I restored the original version of the code where the WORKER TIMEOUT was never showed, but now the WORKER TIMEOUT appears also with the original version, which is weird because before it wasn't appearing
a year ago
Please add the variables back and please stop putting the .env file in the repo.