How to deal with certificate pem for ssl (PGSQL)
Unanswered
Demox posted this in #help-forum
DemoxOP
Hello everyone, I’m trying to deploy a next.js app on Vercel but I’m running into an issue. Since next.js isn’t keeping files such as ca.pem, I can’t keep the connection string that I was using locally to connect to my PGSQL database. (…?sslmode=require&sslrootcert=ca.pem)
So I’m trying to simply keep ?sslmode=require which shouldn’t need ca.pem but then I get this error “ERROR: Error: cannot connect to Postgres. Details: self-signed certificate in certificate chain” which seem to indicate that I can’t connect without providing ca.pem. Is there no way to connect to my db without ca.pem ? I tried searching documentation, forums, chatgpt but I don't see a clear answer. Chatgpt tell me to encode my file in base64 and then embed it in my code using environment variable but that doesn't seem to solve anything since sslrootcert need a file, not the content of the file. Since vercel is serverless, I can't write a file during deployment except in tmp and I would need the file to persist. Is there a way to tell next js to explicitly keep a file during building ? I don't think so but I'm not sure. Thanks in advance for any input or ressource sharing
So I’m trying to simply keep ?sslmode=require which shouldn’t need ca.pem but then I get this error “ERROR: Error: cannot connect to Postgres. Details: self-signed certificate in certificate chain” which seem to indicate that I can’t connect without providing ca.pem. Is there no way to connect to my db without ca.pem ? I tried searching documentation, forums, chatgpt but I don't see a clear answer. Chatgpt tell me to encode my file in base64 and then embed it in my code using environment variable but that doesn't seem to solve anything since sslrootcert need a file, not the content of the file. Since vercel is serverless, I can't write a file during deployment except in tmp and I would need the file to persist. Is there a way to tell next js to explicitly keep a file during building ? I don't think so but I'm not sure. Thanks in advance for any input or ressource sharing