DanLeChambre
CDCloudflare Developers
•Created by DanLeChambre on 10/25/2024 in #pages-help
Astro + Clerk
(cross posting from Clerk)
I have an Astro project deployed to Cloudflare Pages. I have a requirement to add authentication to some areas of the site. I've added the Cloudflare adapter and the Clerk integration as per the docs. I was able to get everything up and running as I wanted locally, but when I deploy to Cloudflare, the deployment fails with the error:
I've tried all sorts to get this working such as experimenting with configs (cloudflare, vite, clerk), moving middleware file around, installing wranlger, using a wrangler.toml with node compat
I have reconstructed a minimal example that generates the error: https://github.com/danlechambre/minimal-astro-cloudflare-clerk (currently deployed to my Cloudflare account)
The project works when deployed, including switching to 'hybrid' and installing the Cloudflare adapter, but the minute I introduce the
clerkMiddleware()
- it breaks 😢
I feel like this is an 'edge thing' - but not really sure what to look at next?
Deploy URL (working before adding Clerk):
https://minimal-astro-cloudflare-clerk.pages.dev/
Account ID: 82b1313af677f5eb2d8633b0bbfc8f732 replies