Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
One .env variable returns correctly but the other one is undefined in the same file

Context: This is a React application and I want to use a .env file to store my DB related credentials. This will probably change in the future, but I can't get this working for some reason.

.env:

REACT_APP_FAUNA_API_KEY=**************** // returns fine if I console.log() it and I can also use it in the rest of the code
FAUNA_DB_ID=***************** // returns undefined

db.js:

import faunadb from "faunadb";

require("dotenv").config();

const client = new faunadb.Client({
  secret: process.env.REACT_APP_FAUNA_API_KEY,
  domain: "db.eu.fauna.com",
  port: 443,
  scheme: "https",
});
const q = faunadb.query;
console.log(process.env.FAUNA_DB_ID);
const databaseID = process.env.FAUNA_DB_ID;

export { client, q, databaseID };
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

For a CRA app (making a guess based on the REACT_APP_FAUNA_API_KEY variable), env vars will only be exposed to the front-end if they start with REACT_APP_

https://create-react-app.dev/docs/adding-custom-environment-variables/

If you rename the variable to REACT_APP_FAUNA_DB_ID, does it return correctly?

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda