-
-
Notifications
You must be signed in to change notification settings - Fork 52
Cloudflare adapter build fail when using pg lib #22
Comments
It seems like we may need the cloudflare adapter to expose the esbuild parameters. There's a related conversation here with svelte's cloudflare adapter: sveltejs/kit#10521 |
This thread also looks highly relevant: sveltejs/kit#10028 |
@jadbox thank you for the report, I'll read through the linked issues, to understand why this happens. IMO the We already support the |
@alexanderniebuhr thanks for taking a look. I still do believe this is an Astro build bug around esbuild. Outside of Astro, Wrangler can use and deploy projects with PG today. (https://developers.cloudflare.com/workers/tutorials/postgres/) |
It is the expected behaviour. We do support If we start to allow Node.js imports, without having the knowledge that it is supported, we will potential allow code, which we should indeed not build. |
Have you tried to put |
I have, and sadly it still trips up build issues for all the many sub libraries used by pg. Maybe it would work if I added add of these libs too, but it looks like overkill at this point. I also now get an Astro Cloudflare adapter error for missing |
I've submitted a PR to get past the astro build error for the missing cloudflare:sockets lib within the Astro Cloudflare adapter. withastro/astro#8766 I'm blocked from continuing to debug this issue until this is merged and deployed. |
The remaining issues are due to a difference between That's the reason I'm going to close this issue. |
Hi, I've run into a similar issue and I've found that cloudflare is compatible with postgres.js as opposed to pg. You can even see in the link from OP https://developers.cloudflare.com/workers/tutorials/postgres/#4-connect-to-the-postgresql-database-in-the-worker that the import is from postgres, not pg I also needed to add the following to my astro config to get build to run: |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
linux
Describe the Bug
Trying to run
astro build
on a Cloudflare project using the lib pg. PG is supported by cloudflare workers.What's the expected result?
I'm not sure, but PG lib is supported by cloudflare. https://developers.cloudflare.com/workers/tutorials/postgres/#4-connect-to-the-postgresql-database-in-the-worker
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-ig3cma?file=astro.config.mjs
Participation
EDIT by @alexanderniebuhr: more context at https://discord.com/channels/830184174198718474/1159635481902972928
The text was updated successfully, but these errors were encountered: