neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
343 stars 13 forks source link

>0.4.4 breaks exports. #24

Closed alexanderniebuhr closed 1 year ago

alexanderniebuhr commented 1 year ago

All versions above 0.4.3 do not work. Only 0.4.3 works.

Expected result

Usable Pool & Client exports

Actual result

Pool is not a constructor
jawj commented 1 year ago

Thanks for your report. I'm assuming that 0.4.9 doesn't fix this? Could you clarify the context that you're seeing this in (e.g. Cloudflare Worker, Node/version, etc)?

alexanderniebuhr commented 1 year ago

Yeah, no 0.4.9 does not fix it. It is in a Cloudflare Pages Function -> so Cloudflare Worker. I did not time to investigate further, in the Editor I can jump to the reference and see the class constructor with all versions. However in runtime it does throw the error. I used to get this a lot with native pg years ago, so I tried to downgrade and see if it is the package or any major issue with my update. Since v0.4.3 works, I expect something changed or broke. Might also be that my setup is incompatible. I can share the full repo (if you want) but it is not isolated reproduction.

jawj commented 1 year ago

OK. I just checked our Cloudflare Worker demo with the latest version (0.4.9) and that seems to work fine: https://github.com/neondatabase/serverless-cfworker-demo

I must admit I've not looked at Cloudflare Pages Functions, so I don't know if there's some difference there. If you could share the failing code, that would certainly be helpful.

jawj commented 1 year ago

Actually, just realized #19 now appears to be reporting the same error with a repro, so I may not need your code just yet ...

alexanderniebuhr commented 1 year ago

Thanks. Let me know if you need any more input from my side.

jawj commented 1 year ago

I've just released 0.4.10, which I believe fixes this issue. Please do confirm either way.

alexanderniebuhr commented 1 year ago

yeah looks like it got fixed with that version.

jawj commented 1 year ago

Great, glad to hear it. :)