How to handle credentials files securely in Netlify Functions?

I have a credentials file used by an authenticating service. This file is in a private github repo, but of course it needs to be used by the lambda functions on the Netlify site when running. Which means it gets deployed on an AWS server somewhere. I really don’t know how secure that is(?).

It would be nice to be able to pass all these authentication fields via environment variables, but I don’t think there’s a way to do that given the service API I am using (it wants a JSON structure).

It’s been months since I last looked into this, so there might be a clean solution. Otherwise, it should be possible to shove all these cert fields into the environment, then then pull them together in a JSON object. Any better way?

Okay, I now see there’s a discussion over on [Common Issues] about setting up credentials, but I didn’t read to see if it addresses this specific issue.

What I did was store the entire JSON cred object as a string in an env var, then parse it to JSON before using it in the application initializer. That worked.

1 Like

thanks for sharing this, @JeffML!

Continuing the discussion from How to handle credentials files securely in Netlify Functions?:

Hi I need help I have facing the issue in website please have a look.