forked from adelsz/pgtyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When I use Pg.Pool.make the same as Pg.Client.make, at runtime I get an error that options is not an object.
Expected behavior
Create a Pool of connections to use in the application, using the ReScript bindings
Test case
open PgTyped
external env: {..} = "process.env"
let dbConfig = "postgres://executor:executor-password@localhost/executor_db"
let client = Pg.Client.make(ConnectionString(dbConfig))
let pool = Pg.Pool.make(ConnectionString(dbConfig))
let getClient = async () => {
let client = await pool->Pg.Pool.connect
client
}
let withClient = async fn => {
let client = await getClient()
let result = client->fn
await result->Promise.then(result => {
client
->Pg.Client.end
->Promise.then(_ => Promise.resolve(result))
})
}This results in an error:
❯ bun --reload src/Index.js
66 | class Pool extends EventEmitter {
67 | constructor(options, Client) {
68 | super()
69 | this.options = Object.assign({}, options)
70 |
71 | if (options != null && 'password' in options) {
^
TypeError: options is not an Object. (evaluating '"password" in options')
at new Pool (/Users/briankaplan/dev/executor/node_modules/pg-pool/index.js:71:42)
at new BoundPool (/Users/briankaplan/dev/executor/node_modules/pg/lib/index.js:16:7)
at /Users/briankaplan/dev/executor/src/Database/Connection.js:9:12
at loadAndEvaluateModule (2:1)
Bun v1.3.3 (macOS arm64)
I'm also using your rescript-bun library, so I'm using ReScript v12.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working