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

Remove dependency to crypto so node-postgres can run on the edge #3050

Closed
harrispap03 opened this issue Aug 31, 2023 · 3 comments
Closed

Remove dependency to crypto so node-postgres can run on the edge #3050

harrispap03 opened this issue Aug 31, 2023 · 3 comments
Labels

Comments

@harrispap03
Copy link

I'm using node-postgres alongside with drizzle-orm.

I'd like to be able to make queries on the edge, though that's not possible due to the dependency of node-postgres to the crypto library.

Is there a chance it can be removed on the future so it can run on the edge ?

Edge reference here

@harrispap03 harrispap03 changed the title Remove dependency to crypto so node-postgress can run on the edge Remove dependency to crypto so node-postgres can run on the edge Aug 31, 2023
@charmander
Copy link
Collaborator

  • As of Cloudflare Workers support #2971, the Web Crypto API is already used instead of the Node crypto module where possible.

  • node_modules can be used, as long as they implement ES Modules and do not use native Node.js APIs

    though? pg isn’t ESM-based, and uses other Node APIs, like net. pg includes a Node-like API wrapper for Cloudflare Workers, but I don’t even see the ability to make TCP connections in the linked documentation.

  • (Is your PostgreSQL server also on the edge?)

@harrispap03
Copy link
Author

Hmm, that's interesting, it seems there are many roadblocks to get this working on the edge.

To be fair I haven't decided on the location of my db. It could be on the edge. I guess in this case I should use some other driver from drizzle

@savelichalex
Copy link

I had the same problem for Cloudflare Pages, I ended up patching the package, removing any require('crypto') calls, since this was the cause. Basically my edge function fell even before execution of the function logic itself, it fell in the import stage.

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

No branches or pull requests

3 participants