Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONNECT_TIMEOUT with npm module on Deno #723

Open
ralfstx opened this issue Nov 6, 2023 · 3 comments
Open

CONNECT_TIMEOUT with npm module on Deno #723

ralfstx opened this issue Nov 6, 2023 · 3 comments

Comments

@ralfstx
Copy link

ralfstx commented Nov 6, 2023

Deno interoperability with npm has come a long way. We'd like to use the Deno runtime without any deno-specific dependencies. If we could use the postgres npm module instead, this would allow us to manage dependencies in package.json instead of deno.json, get rid of the buggy Deno tooling for VSCode, and create code that works on both Node and Deno.

Unfortunately, when I try [email protected] with Deno, I get a connection timeout, while the same code works with the deno port.

Error: write CONNECT_TIMEOUT undefined:undefined
    at connectTimedOut (file://my-project/node_modules/.deno/[email protected]/node_modules/postgres/src/connection.js:257:20)
    at Timeout.done [as _onTimeout] (file://my-project/node_modules/.deno/[email protected]/node_modules/postgres/src/connection.js:1035:8)
    at cb (ext:deno_node/internal/timers.mjs:63:31)
    at Object.action (ext:deno_web/02_timers.js:151:11)
    at handleTimerMacrotask (ext:deno_web/02_timers.js:65:10)
    at eventLoopTick (ext:core/01_core.js:189:21)
    at cachedError (file://my-project/node_modules/.deno/[email protected]/node_modules/postgres/src/query.js:170:23)
    at new Query (file://my-project/node_modules/.deno/[email protected]/node_modules/postgres/src/query.js:36:24)
    at sql (file://my-project/node_modules/.deno/[email protected]/node_modules/postgres/src/index.js:112:11)

Any chance to get this resolved?

@approached
Copy link

In Bun is a same issue: #749
How i can it reproduce? Can you create a example?

@PAdventures
Copy link

I have a similar issue with the following error:

Error: write CONNECT_TIMEOUT undefined:undefined
    at connectTimedOut (file:///PATH/TO/DENO/npm/registry.npmjs.org/postgres/3.4.4/src/connection.js:257:20)
    at Timeout.done [as _onTimeout] (file:///PATH/TO/DENO/npm/registry.npmjs.org/postgres/3.4.4/src/connection.js:1033:8)
    at cb (ext:deno_node/internal/timers.mjs:64:31)
    at callback (ext:deno_web/02_timers.js:68:7)
    at eventLoopTick (ext:core/01_core.js:210:13) {
  code: "CONNECT_TIMEOUT",
  errno: "CONNECT_TIMEOUT",
  address: undefined,
  port: undefined
}

@msgerbush
Copy link

I was running into this same issue and it was due to importing 'postgres' from npm. I switched the import to:
https://deno.land/x/postgresjs/mod.js and the timeout went away. The Deno installation instructions are tucked away here: https://github.com/porsager/postgres/blob/master/deno/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants