Stream error with node-postgres (Suspected Deno runtime bug)

I think I have found an error in Deno's stream implementation, or at least an instance where it doesn't match node's implementation. I am putting together a bug report, but I wanted to see if anyone had any ideas before I send it.
3 Replies
Weldawadyathink
WeldawadyathinkOP3d ago
The issue presents with node-postgres. When connecting to pgbouncer using ssl, and running client.end(), nothing happens, the promise doesn't resolve or reject, and deno gives an error about a promise not resolving, with no stack trace. The issue isn't present if ssl is disabled, but that is not good for production. In node, the (almost) exact same code runs without issue even if ssl is enabled. The offending code from node-postgres appears to be this:
end() {
// 0x58 = 'X'
this._ending = true
if (!this._connecting || !this.stream.writable) {
this.stream.end()
return
}
return this.stream.write(endBuffer, () => {
this.stream.end()
})
}
end() {
// 0x58 = 'X'
this._ending = true
if (!this._connecting || !this.stream.writable) {
this.stream.end()
return
}
return this.stream.write(endBuffer, () => {
this.stream.end()
})
}
The this.stream.end() is never called, even though pgbouncer closes the stream just fine. Anyone experience any issues with node-postgres in Deno?
Weldawadyathink
WeldawadyathinkOP3d ago
GitHub
npm:pg Top-level await promise never resolved · Issue #28543 · de...
Version: Deno 2.2.4 Hello, please run this code: import pg from "npm:pg"; // Fill it with credentials const client = new pg.Client({ user: "", password: "", host: &quo...
Weldawadyathink
WeldawadyathinkOP3d ago
looks like that's my exact issue

Did you find this page helpful?