S
SolidJS6mo ago
omfj

How do get Cloudflare bindings in dev?

I am struggling to access my Cloudflare bindings in devleopment using Solid Start. I created the project using create-cloudflare.
import { getRequestEvent } from "solid-js/web";

export const getContext = () => {
const event = getRequestEvent()!;
console.log(JSON.stringify(event.nativeEvent.context.cloudflare, null, 2));
};
import { getRequestEvent } from "solid-js/web";

export const getContext = () => {
const event = getRequestEvent()!;
console.log(JSON.stringify(event.nativeEvent.context.cloudflare, null, 2));
};
This works when running pnpm preview, but returns undefined when running in dev (vinxi dev). I suspect there might be a bug in Vinxi or maybe I have to add something to my dev command? Does anyone have experience with this?
3 Replies
Tommypop
Tommypop6mo ago
GitHub
🚀 Improve the SolidStart Cloudflare (bindings) integration · Issue ...
Describe the solution Summary People deploying their SolidStart applications to Cloudflare Pages do not have a proper DX when it comes to accessing Bindings, it would be great if we could find a so...
omfj
omfjOP6mo ago
Thank you, @Tommypop !
BiffBaffBoff
BiffBaffBoff3mo ago
Sorry to drag up an old post, has this improved at all? I followed Ryan's guide here: https://ryanjc.com/blog/solidstart-cloudflare-pages/ but it just wasn't working locally (I tried D1 and R2).
Deploying SolidStart to Cloudflare Pages
Deploying SolidStart (Nitro) to Cloudflare Pages
Want results from more Discord servers?
Add your server