Behavior of secrets / environment variables with newlines (escaped / unescaped characters)

Now that's weird.
When I put my key in a variable in the code (let key = "..."), it works perfectly but if I put the same key (I copy pasted it) in a secret, the importPKCS8() function results in an error :
atob() called with invalid base64-encoded data. (Only whitespace, '+', '/', alphanumeric ASCII, and up to two terminal '=' signs when the input data length is divisible by 4 are allowed.)

So it works but I would prefer to have the value in a secret since it's the key to my Google Cloud Service Account so it's not great for security to literally have it in my code...
Was this page helpful?