Ask coding questions

← Back to all posts
Not able to set environment variales. Am I missing something?
asxyzp (2)

In a node.js repl, I tried to access an environment variable set using the "secret" tab using, process.env[PROJECT_KEY] but it returned undefined. Next, I tried using dotenv package to access the environment variable in, but still couldn't access it. Here's what I'm currently trying to do :

const process = require('process');
const key = process.env.PROJECT_KEY;
const deta = Deta(key);                     
const tag = deta.Base('tag');

Please haaaaaaaaaalp!