postgres icon indicating copy to clipboard operation
postgres copied to clipboard

deno: move from std node polyfills to `node:` specifier

Open Kyiro opened this issue 1 year ago • 5 comments

Hello

I've been using postgres.js in a Deno project for a while but I just noticed how outdated the compatibility really is.

Before this gets accepted though, I'd also like to solve these errors when the connection string is invalid/can't connect. I have no idea if these happen on node but I'd assume not.

error: Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
      stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
                                               ^
    at queryError (file:///C:/Projects/postgres/deno/src/connection.js:391:48)
    at errored (file:///C:/Projects/postgres/deno/src/connection.js:386:17)
    at Socket.error (file:///C:/Projects/postgres/deno/src/connection.js:378:5)
    at Socket.emit (ext:deno_node/_stream.mjs:1852:9)
    at emitErrorNT (ext:deno_node/_stream.mjs:1572:13)
    at emitErrorCloseNT (ext:deno_node/_stream.mjs:1544:7)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:33:15)
    at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
    at eventLoopTick (ext:core/01_core.js:189:21)

Kyiro avatar Jan 07 '24 22:01 Kyiro

same 👍

mufaroxyz avatar Jan 08 '24 11:01 mufaroxyz

It'd honestly be good to get this merged and resolve the error issue at a later date because of those warnings, could we get this PR reviewed?

Kyiro avatar Jan 30 '24 14:01 Kyiro

I'm thinking a hard cut in v4 where we just remove the deno polyfill completely if possible?

porsager avatar Feb 17 '24 12:02 porsager

As Deno got npm compatibility a while back, I think it might be the right play but this could still get accepted for v3 to avoid headaches

Kyiro avatar Feb 21 '24 11:02 Kyiro

As Deno got npm compatibility a while back, I think it might be the right play but this could still get accepted for v3 to avoid headaches

Yes, the current version on supabase/edge-runtime it's not just a warning, but it triggers an error and become unusable:

runtime has escaped from the event loop unexpectedly: event loop error: TypeError: internals.warnOnDeprecatedApi is not a function
    at get rid (ext:deno_io/12_io.js:277:15)
    at createWritableStdioStream (https://deno.land/[email protected]/node/_process/streams.mjs:29:21)
    at https://deno.land/[email protected]/node/_process/streams.mjs:68:38

While switching to use this PR the error is gone.

mdluo avatar Feb 21 '24 13:02 mdluo