Replies: 3 comments 3 replies
-
|
For anyone else really struggling with this, if you're using the cloudflare_durable nitro preset, here's the best "hack" I've been able to find, using as Then you can: But.... YUCK, this pollutes with global state vs "serverless", and much complex too. It would be much better to have easy access the event passed in to crossws in the first place, but it doesn't expose it, only on peer._internal. |
Beta Was this translation helpful? Give feedback.
-
|
Have you tried to access bindings from |
Beta Was this translation helpful? Give feedback.
-
|
Would really love a solution for this issue, going down the same road |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Because cloudflare does not set process.env (ugh, I wish they did, but that's another story), to access any bindings, secrets etc you need access to the cloudflare env, passed with every request.
This is well documented for regular HTTP requests: https://nitro.build/deploy/providers/cloudflare#direct-access-to-cloudflare-bindings
It would be great to document the right way to access the cloudflare env, like bindings, from a websocket handler.
Beta Was this translation helpful? Give feedback.
All reactions