Parse private key for vertex.ai in json

i am building a server with C# that connect to vertex.ai. when i run locally everything works smoothly, but when i try the deployed version on render i am facing a problem. I have a big credentials JSON object with several fields, and one of them is “private_key” which begin with “-----BEGIN PRIVATE KEY-----” and ends with “-----END PRIVATE KEY-----“, with a long text with several “\n” in it.
For some reason this private key throws me this exception when i am trying to build the vertex client:

System.InvalidOperationException: Error deserializing JSON credential data.

       ---> Interop+Crypto+OpenSslCryptographicException: error:0200007B:rsa routines::d e not congruent to 1

         at Interop.Crypto.DecodePkcs8PrivateKey(ReadOnlySpan`1 source, EvpAlgorithmId algorithmId)

         at System.Security.Cryptography.RSAOpenSsl.ImportParameters(RSAParameters parameters)

         at Google.Apis.Auth.OAuth2.ServiceAccountCredential.Initializer.FromPrivateKey(String privateKey)

         at Google.Apis.Auth.OAuth2.CredentialFactory.CreateServiceAccountCredentialFromParameters(JsonCredentialParameters credentialParameters, Type targetType)

         at Google.Apis.Auth.OAuth2.CredentialFactory.<FromJsonParameters>g__CreateCredential|5_0[T](JsonCredentialParameters credentialParameters, Type targetCredentialType)

         at Google.Apis.Auth.OAuth2.CredentialFactory.FromJsonParameters[T](JsonCredentialParameters credentialParameters)

         at Google.Apis.Auth.OAuth2.CredentialFactory.FromJson[T](String json)

locally this exact code and object works perfectly.
I tried convert the object to base64 and parse it on run, read the object from file instead of env var, and also read it as a stream. All of these efforts came with the same result above