Hello,
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}
)
console.log(process.env.TWEET_KEY)
console.log(process.env.APP_SECRET)
console.log(process.env.A_TOKEN)
console.log(process.env.A_SECRET)
console.log(process.env.TEST)
;})
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
});