Does Hono Cloudflare Pages work with `@supabase/supabase-js`?
Logs
These were my errors on
bun run dev
, full logs attached.
Code
Check it: https://github.com/Luzefiru/netzwelt-ats/blob/feat/supabase-integration/vite.config.ts14 Replies
I was able to use Supabase before with Hono in a small project, but without
vite
and simply served the files & ran the app via wrangler
.
I'm guessing it's because Supabase uses nodejs
modules and it's not compatible with the Cloudflare Pages runtime environment.It says it’s compatible with workers
Cloudflare Docs
Supabase · Cloudflare Workers docs
Supabase is an open source Firebase alternative and a PostgreSQL database service that offers real-time functionality, database backups, and …
Supabase
CloudFlare Workers | Works With Supabase
Using Supabase from your Cloudflare Workers just got even easier.
Side note (about workers): the last release of supabase-js/supabase-auth seems to have some issues when running inside the workers: https://github.com/supabase/supabase-js/issues/1001#issuecomment-2029478541
Using a previous version "just works".
This is not directly related to your question about Cloudflare Pages (I can't answer this part), but beware if you try to use cloudflare workers at the moment
GitHub
The 'cache' field on 'RequestInitializerDict' is not implemented - ...
Bug report I confirm this is a bug with Supabase, not with my own application. I confirm I have searched the Docs, GitHub Discussions, and Discord. Describe the bug When using the following method ...
Yeah, it does work with workers. The issue only happens once I introduce the
pages()
honojs/vite-plugins/cloudflare-pages plugin.
Here are my minimal repros for this:
Hono Workers Template + Supabase | Worker /tasks Route
Hono Pages Template + Supabase | Pages /tasks Route
thanks for the heads up! i'll explore this once I implement auth later down the line
oh yup, even if you do not use the /supabase-auth
module, it throws the error with wrangler![No description](https://cdn.answeroverflow.com/1225419507804409887/image.png)
Yup, see the comments in the issue I've linked, there is a workaround described, I hope this will get fixed soon, this sucks
I found a workaround for this. I ditched Vite in favor of manually using ESBuild / bun to bundle the server entry script into a
_worker.js
then serve static files following a similar approach to this tutorial on the Cloudflare Docs: https://developers.cloudflare.com/pages/framework-guides/deploy-a-hono-site/Cloudflare Docs
Deploy a Hono site · Cloudflare Pages docs
Hono is a small, simple, and ultrafast web framework for Cloudflare Pages and Workers, Deno, and Bun. In this guide, you will create a new Hono …
thank you @Alex Kontos for pointing me to the right direction
NP!
so you bypassed wrangler as well ? going directly with esbuild to bundle the worker ?
I use wrangler for the development preview & the deployment scripts
Thanks !