Trying to connect to a Snowflake destination via K...
# replication-troubleshooting
f
Trying to connect to a Snowflake destination via Key Value Pair that works using snowpark. Getting the following error: Could not connect with provided configuration. net.snowflake.client.jdbc.SnowflakeSQLLoggedException: Private key provided is invalid or not supported: rsa_key.p8: Cannot invoke "net.snowflake.client.jdbc.internal.org.bouncycastle.util.io.pem.PemObject.getContent()" because the return value of "net.snowflake.client.jdbc.internal.org.bouncycastle.util.io.pem.PemReader.readPemObject()" is null
k
The error message you are seeing—`Private key provided is invalid or not supported: rsa_key.p8: Cannot invoke ... PemReader.readPemObject() is null`—suggests that the private key file you are providing to Airbyte is either not in the correct format or is empty/corrupted. According to the Airbyte documentation, for key pair authentication with Snowflake, you must generate your private key in the correct PEM format. The recommended way to generate an unencrypted private key is:
Copy code
bash openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
For an encrypted private key, use:
Copy code
bash openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -v2 aes-256-cbc -out rsa_key.p8
After generating the private key, you should also generate the public key and add it to your Snowflake user account. Make sure that the private key file (
rsa_key.p8
) you provide to Airbyte is the actual PEM file generated by the above command and that it is not empty or malformed. Also, ensure that the file starts with
-----BEGIN PRIVATE KEY-----
and ends with
-----END PRIVATE KEY-----
(for PKCS#8 format), and that there are no extra spaces or characters. If you generated your key in a different way (for example, using a different tool or format), it may not be compatible with the Snowflake JDBC driver used by Airbyte, even if it works with Snowpark. Double-check your key generation process and try regenerating the key as described above. For more troubleshooting tips, you can refer to [Snowflake's troubleshooting docs](https://docs.snowflake.com/en/user-guide/key-pair-auth-troubleshooting) as suggested in the Airbyte documentation. If the problem persists after confirming the key format, there may be an issue with how the key is being read or passed to Airbyte, or a compatibility issue between the key and the JDBC driver version in use [Key pair authentication](https://docs.airbyte.com/integrations/sources/snowflake#key-pair-authentication). If you need further help, please provide details on how you generated your key and how you are configuring the Airbyte destination.