eiger
eiger
RRailway
Created by eiger on 6/2/2023 in #βœ‹ο½œhelp
API key not recognized on deployment, even after declaring the variable (Project type: NodeJS/React)
Hello! It's my first time posting here. I'm trying to fetch pubmed articles for my personal website and I'm running a NodeJS/React app for that purpose. To fetch the articles, i'm using the Pubmed API and used a variable like this => const apiKey = process.env.YOUR_API_KEY;. I saved my API key in Railway as an environment variable, but I realized that it wasn't read by the CI somehow and is shown as undefined. Using the API key locally (in the non-secure way) worked well, and my main issue is linked with the environment variable declaration... When checking the content of process.env, I realized there isn't any environment variable as shown here:
Object { NODE_ENV: "production", PUBLIC_URL: "", WDS_SOCKET_HOST: undefined, WDS_SOCKET_PATH: undefined, WDS_SOCKET_PORT: undefined, FAST_REFRESH: true }
Object { NODE_ENV: "production", PUBLIC_URL: "", WDS_SOCKET_HOST: undefined, WDS_SOCKET_PATH: undefined, WDS_SOCKET_PORT: undefined, FAST_REFRESH: true }
I might be fooled by the inspector/console log though. Note that before using Railway, I had the exact same issue with Netlify πŸ˜“ Project ID: 4d7cb82a-87a2-496e-b702-70b5ed733e7d If you have questions in order to clarify the issue, feel free to ask! I'll do my best to answer them! 😁 Thank you by advance πŸ™ PS: I think it's possible that's it's a duplicate of that thread. Apologies by advance .https://discord.com/channels/713503345364697088/1110912233980051508/1111059762554085497 ...
13 replies