Hey, using Typescript. I'm currently trying to cr...
# general
c
Hey, using Typescript. I'm currently trying to create a postgres role in my DB using Pulumis PostgreSQL Package. I've create a Provider similar to this:
Copy code
const provider = new Provider("test-provider", {
         host:      "<my domain>",
         port:      5432,
         username:  "<username>",
         password:  "<password>",
         superuser: true,
         sslmode:   "disable",
         database:  "<database>",
      });
but for some reason doing
Copy code
const user = new Role("user", {
         name:     "user",
         password: "randomString",
         login:    true,
      }, {provider: provider});
results into an
error creating role user: driver: bad connection
. I've used the
psql
command to connect to the database with the same credentials as the provider got and that connection worked without a problem. Any Ideas what could be wrong? Is there a way to get some more information what could cause this error?
l
It's tough to know but it is almost certainly something about the connection details you are providing. It could be
sslmode
since
psql
will by default be quite permissive about what it takes there (unless you are providing an
sslmode=
in a
postgresql://
-style connection string)
c
Is there a way to debug this to figure out which connection detail causes this?
Or do i have to just try & error until it works? :S
Alright, I changed all connection details one by one and changing them causes pulumi to show an error that they are not correct. So i guess the details i've provided are correct. But what could cause the
bad connection
? Is there something missing in my details which
psql
provides automatically?
l
Googling suggests that maybe the connection is establishing OK, but then something is going wrong (e.g. a bad statement is being sent to PG) that means subsequent uses of the connection fail with the
bad connection
error. I'm not exactly sure what could be being sent to make the connection sour though. I'm guessing the
superuser
property makes no difference?
a
have you tried it with hostname/credentials/etc specified via config instead of defining a provider?