Question or Feature Request: What's the

Question or Feature Request: What's the best way to get access to the env from within a MC event handler? I've ended up modifying the worker template to prop drill the env down to the component. If that's the best way, I guess I'd like to request that a way to access the env from within components be explored and integrated into the MC spec. My use case in particular is to get access to a service binding.
3 Replies
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Mackenly
Mackenly4mo ago
The env is passed in and used for accessing KV but the env is a private property and doesn't have a getter so can't be accessed from the component. Making that property/field public would probably be perfect unless there's a security concern. https://github.com/cloudflare/managed-component-to-cloudflare-worker/blob/main/src/manager.ts
GitHub
managed-component-to-cloudflare-worker/src/manager.ts at main · clo...
Deploy Managed Components as Cloudflare Workers and use them in Cloudflare Zaraz - cloudflare/managed-component-to-cloudflare-worker
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View