Mik-A
February 24, 2020, 2:13pm
1
have managed to get most of my environment variables to work. Except Google private key.
I use netlify-lambda and run API calls in node.js. If I hard code the key/value in the function then it works. Can it have something to do with the key itself? it looks like this:
NODE_ENV_GOOGLE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nM…lM=\n-----END PRIVATE KEY-----\n
fool
February 25, 2020, 10:28pm
2
This is how I handle keys, since carriage returns are really tough in environment variables:
Last checked by Netlify Support Team: December 2022
Some workflows require use of an SSH private key during build - for instance, logging in to a server to restart your backend, or using git clone on a private repo during build. There are better ways to accomplish this goal for most use cases, but in case you choose to do that, below is an approach that can work.
First, create an ssh key and add the public key (shorter one) to your service (e.g. on your GitHub repo settings, or in ~/.ssh/auth…
Additionally, please note that there is a hard limit of 4k total characters in environment shipped to a lambda function - in the format:
VAR1=val1,VAR2=val2 ...
so…it’s pretty challenging to get that key in there depending on length!