.env keys not reading


I am having an issue reading the process.env keys from an .env file which stores my twitter api keys.

the code works fine in my localhost but when I upload to render it stops working. I consoled logged the keys and the values appeared in the console but somehow its not reading the keys:

app.listen(port, () => {
console.log(Server listening on port ${process.env.PORT})

When i replace the code with the actual key it works:

const key = process.env.TWEET_KEY

const secret = process.env.APP_SECRET

const atoken = process.env.A_TOKEN

const asecret = process.env.A_SECRET

app.use(express.static(path.join(__dirname, ‘public’)));

const client = new TwitterApi({
appKey: key,
appSecret: secret,
accessToken: atoken,
accessSecret: asecret


you have to add ENV variable manually from render hosting panel


Secret Files don’t do any magic, or get parsed by the platform, if you create .env file you’ll need something to read it, like a dotenv package.

Or, you can add the environment variable individually, which would make them available to the service environment, as the previous commented suggested.