mihaaai
Explore posts from serversIs there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
Unfortunatelly it won't work, the lib requires you to export an
auth
object from a auth.ts
file to be able to run the CLI tool for migration against it, if I define the auth
object within a middleware I can't export it and the CLI isn't able to find it.
It also requires me to store another Variable in the context with c.set("auth", auth)
besides the session
and user
already stored in the middleware example to be able to use the handler for the /api/auth/**
routes becoming a strange antipattern.10 replies
Is there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
Mmm, not sure this is an optimal way, only imports of
betterAuth
and Kysely
are about half MB of bundle size, again not sure if this is a heavy lift to the whole app, since being it a middleware will execute the setup each time a request comes in, also this lib has handy methods to manage state for Hono, but no reference of D1 Binding within Hono10 replies
Is there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
No luck, no matter what I try seems impossible to get a reference of the BIndings, even with the docs about contextStorage() it crashes the app on runtime with
service core:user:app: Uncaught Error: Context is not available
10 replies