Open arnaudjnn opened 2 years ago
Any chance you have this variable set? NODE_PG_FORCE_NATIVE
https://github.com/brianc/node-postgres/blob/28ac2a17bce287cfa458153dcabe3ca06ca0e28f/packages/pg/lib/index.js#L28
I have never used Netlify myself, but I have found something: https://github.com/brianc/node-postgres/issues/1894#issuecomment-543010595
@MatteoGioioso I tried to set NODE_PG_FORCE_NATIVE
but this does not solve the error.
Is it possible to use postgres instead pg as detailed here?
https://answers.netlify.com/t/continues-deployment-of-functions-with-postgresql/44730/30
@arnaudjnn I think you should unset it.
regarding to use another library, I think it should be possible: https://github.com/MatteoGioioso/serverless-pg/blob/37f52a95139f7581b87c69797dec61899b6891dd/__tests__/index.test.js#L565
however the API must be compatible
Sorry no I haven't this variable NODE_PG_FORCE_NATIVE
How would you do to use another library like postgres
?
Would be awesome to get an example working with Netlify!
You could try something like that
const yourDriver = require("custom-driver")
const client = new ServerlessClient({
...dbConfig,
debug: true,
library: yourDriver
});
although I see that the library you are suggesting use quite different API. I will test something and let you know.
PS: have you tried this? https://github.com/brianc/node-postgres/issues/1894#issuecomment-543030502
It may be worth considering running the library through a bundler to make this problem go away.
I've spent most of today trying to get pg through parcel without any luck, and it would certainly make some sense for this library to deliberately excise pg-native
for ease of bundling.
I'm using Netlify functions for serverless
When I tried
serverless-pg
I had the following error:So I installed pg-native, working well locally but then I have the following error with deploy: https://answers.netlify.com/t/unable-to-publish-function-using-postgres/12293
Do you have an install with Netlify? How can I fix the error with libpq?