Jan Piotrowski (janpio)
CDCloudflare Developers
•Created by Jan Piotrowski (janpio) on 12/19/2023 in #workers-help
Is there a way to use `pg` in a Next.js project setup with `@cloudflare/next-on-pages?
I have project that is setup following https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/, and now I tried to use
pg
to connect to a remote database. As soon as I import and use pg
in one of my funtions though, I get errors like this during npm run build
:
How can I use pg
in a Next.js project that I want to deploy to Cloudflare Pages?21 replies
CDCloudflare Developers
•Created by Jan Piotrowski (janpio) on 12/13/2023 in #pages-help
How to know when deployment was successful and is reachable?
Is there a way to check/know after a wrangler pages deploy that the page and its functions are successfully deployed and reachable?
I am already waiting for 5s after deploy before I check, but often that still leads to a HTML page instead of the Json that I expect from my function/worker.
7 replies
CDCloudflare Developers
•Created by Jan Piotrowski (janpio) on 12/9/2023 in #pages-help
How to set environment variables via `wrangler pages deploy` per deployment?
I managed to deploy a project with
wranger pages deploy
, but a function that is included there requires an environment variable - and optimally I could set that per deployment. Is that a thing for Pages? Or do I have to set it via the UI for all preview
deployments?3 replies
CDCloudflare Developers
•Created by Jan Piotrowski (janpio) on 12/9/2023 in #pages-help
Deployment logs to understand `Status: Failed`?
I have some deployments via
wrangler pages deploy
that in theory should work (they work fine locally via wrangler dev
), but after deploy
I only see Status: Failed
in the web UI for that deployment. I could not find any deployment logs.
Am I overlooking something?32 replies
CDCloudflare Developers
•Created by Jan Piotrowski (janpio) on 12/9/2023 in #pages-help
Use `pg` in Pages Function?
I want to access a PostgreSQL database in a function that will be deployed via Cloudflare Pages. Workers supports using
pg
, the common Node PostgreSQL database.
But I can not make it work with the Functions in Pages. I get errors like this on pnpm wrangler pages dev .
-:
If I understand the error message correctly, I am supposed to do pnpm wrangler pages dev . --compatibility-flag="nodejs_compat"
- but that returns exactly the same error.
(I know that in Workers I actually need to use
node_compat
(which sounds similar, but it something very different) - but that does not seem to exist for Pages)5 replies
CDCloudflare Developers
•Created by Jan Piotrowski (janpio) on 12/7/2023 in #workers-help
Running jest tests in `workerd` environment?
We develop a library that should work on Cloudflare Workers. We have a huge test suite, that tests its full API in all the combination we could think of. Is there a good way to run our existing jest test suite in a
workerd
like environment?12 replies