[Support Guide] Using environment variables on Netlify correctly

I could use some help on this topic.

Here’s what I’ve done so far.

  1. Created an app that needs to read in an API key.
  2. Created a an environment variable for it in my Netlify Build & Deploy > Environment settings.
  3. Created a Netlify (AWS) Lambda function to expose my environment variable from step 2.

This works great so far. When I hit the endpoint for my Lambda function, it displays my API key in a webpage.

But, I need to access this key in my server.js. Sorry for the “noob” question, how to read my API key env var in my server.js file? What am I missing?

Any help is greatly appreciated! Thanks!

Cross-posted from here.