7 hours ago
We are trying to re-deploy in our stage (baandaserver-stage). We have all the environment variables defined. It has been working for a long time no issues. It seemed it was using our development environment from our local config file (that is explicitly removed via .gitignore). Now it is crashing because it cannot find the API keys, mongodb url etc. But, if we replace the keys_dev.js with variables it will work all right. This would be a major security issue. Something must have happened very recently for our stage (also QA) to work improperly, particularly that is has been working fine until now. This is a serious concern. You can definitely check the variables. I will keep the crashed version, so you know the issue.
8 Replies
7 hours ago
Having looked into this, the issue appears to be in your application code or configuration rather than the Railway platform itself, which puts it outside what Railway support can resolve directly.
This is exactly the kind of problem the Railway community is good at, so we'd like to open your thread as a community bounty. Railway pays a bounty to the community member who solves it, and threads like this usually get picked up quickly.
Opening it makes this entire thread public, including everything already posted. Nothing becomes public until you decide. Use the buttons below.
- Open to the community - Before you click, take a moment to edit or remove anything you'd rather not share. The thread becomes publicly visible right away.
- Keep it private and close the thread - Nothing becomes public and the thread closes.
Status changed to Awaiting User Response Railway • about 7 hours ago
6 hours ago
This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.
Status changed to Open Railway • about 6 hours ago
6 hours ago
Just to clarify, does it work or not work when using variables provided through Railway?
6 hours ago
Please go to activity panel to see how this is happening.
Attachments
6 hours ago
Can you provide logs or a description instead of "go to activity panel"? Moderators aren't able to access user's services.
6 hours ago
I just attached a pdf showing what is happening. The crash log stated that it cannot find API keys. So, I copied the log where it shows that it cannot find the API key and then screen printed to show that it is indeed defined as an environment variable. I am attaching the pdf again. I do not know when a ticket is for all, if you can open our deployment. Now, up until very recently, it was working all right. I re-deployed but including all the keys, URL, passwords etc. in my local config file and is not working all right. The issue is, we should not be doing that and is the very reason why we have environment variables... right? Attaching the partial log file again.
Attachments
0x5b62656e5d
Can you provide logs or a description instead of "go to activity panel"? Moderators aren't able to access user's services.
6 hours ago
I am supplying the log file. I am wondering if some upgrades or something has happened in Railways to manifest this recently.
6 hours ago
Did you make sure to update your application to use environment variables instead of a hardcoded set of variables in a configuration file?
3 hours ago
The presence of a key in Railway's Variables UI does not tell us whether the running Node process reads that key. In particular, a gitignored keys_dev.js will not be present in the Git deployment unless it is generated during the build, and code that imports that file will not start reading process.env merely because a same-named variable exists. Railway makes service variables available at build time and at runtime: https://docs.railway.com/guides/frontend-environment-variables
A safe way to separate the two causes, without posting any secret values:
- In the stage service Variables tab, verify the exact names your application reads (case-sensitive), apply any staged changes, and inspect the newly deployed stage revision rather than an older deployment.
- Temporarily log only presence in the server startup path, e.g. console.log('env-check', { environment:
process.env.RAILWAY_ENVIRONMENT_NAME, apiKeyPresent: Boolean(process.env.YOUR_ACTUAL_KEY_NAME), mongoUrlPresent: Boolean(process.env.YOUR_ACTUAL_MONGO_NAME) }); Do not log the values. Compare those names with the actualprocess.envaccesses in the code and config module, not with thekeys_dev.jsobject keys. - If both flags are true but the app says keys are missing, trace the exact import/config branch and map it explicitly, e.g. apiKey:
process.env.YOUR_ACTUAL_KEY_NAME. If false, check variable scope/reference in that service and stage environment, and that the change was deployed. If a variable is consumed by client/build code, rebuild the app; server-only values should stay on the server.
Please remove any plaintext credentials added to a config file and rotate any that entered a Git commit or public attachment; .gitignore does not remove already tracked files. You can share the redacted import/config code and just the true/false presence result. That would pinpoint which side is failing without disclosing keys.