DwarfNinja
CDCloudflare Developers
•Created by DwarfNinja on 2/19/2025 in #workers-help
Receiving webhook in a worker and sending it to the frontend?
Hey dear Cloudflare dev's,
I receive a webhook from Mollie and want to forward its data to my frontend. As I understand, since workers are stateless, I can't share variables between functions eg. a global
let webhook-data
variable.
My current approach stores the data in Cloudflare KV and then polls it to send via websockets or server-sent events, which feels overly complex and has it's own pitfalls.
While Durable Objects offer in-memory state, I’m trying to keep costs low and it seems a large solution for what feels to be a small problem.
Are there any suggestions how to best solve this? Thanks in advance!
See the snippit below for an example of the above case:
9 replies