Environment variables for Netlify functions

I’m getting this error on build

failed during stage ‘building site’: Environment variable ‘AWS_ACCESS_KEY’ isn’t available for direct interaction

locally, I have this key in a .env file, but Im not pushing it to repository.

How to fix this?

Thanks

Hi, @Charterfront, and welcome to our Netlify community site. :+1:

Have you tried adding this as an environment variable in the Netlify UI? That keeps it out of your repo and still allow the Netlify build system to use it.

If that doesn’t resolve the issue and/or there are other questions, please let us know.

Hi, that’s exactly what I’ve done, and why I’m getting that error. When I remove it from the Netlify UI build & deploy settings, it becomes ok again

Hi, @Charterfront, would you please send us a link to the deploy with that error?

Here you go

https://app.netlify.com/sites/equals-results-dev/deploys/5e5661df81c97c000a4e1cfa

Thanks

Thanks for sending that over! I believe you’re running into this because AWS_ is a reserved prefix for environment variables. More from @Dennis here:

Depending on which AWS service you’re using, there should be docs for custom named vars or passing a config file.

This post describes how to access those vars on the Netlify side:

Let us know how it goes or if we can help further!