How to use / enable 'eval()' in CF workers?

I would love to use eval in my workers code and I fully understand the risks of it. It seems the PR has made it available in workerd and workers SDK, is it available on CF workers as well yet? How can I enable it? https://github.com/cloudflare/workerd/pull/1338 I'm not sure how to set the --experimental flag if so, (Still getting eval is undefined after wrangler build --experimental)
GitHub
Implement an UnsafeEval binding by jasnell · Pull Request #1338 ·...
This adds a new UnsafeEval binding APi that is intended only for use with workerd and only when the --experimental flag is specified. See the included test for an example on how to use it. console....
12 Replies
Unsmart
Unsmart13mo ago
I'd be very surprised if this is ever enabled on hosted cloudflare workers, afaik in the past they have been very strict in saying this would not come because it cannot be audited what runs through it. Workers for platforms will eventually be available to Pay-Go customers which supports uploading unlimited number of scripts.
dwayn
dwaynOP13mo ago
But what is the concern if the developer is aware unsafe code can be ran? Like the developer opts in
Unsmart
Unsmart13mo ago
Cloudflare wants to be able to audit what is run the concern isnt with the user uploading the worker
dwayn
dwaynOP13mo ago
does this mean all code is shared and accessible by cloudflare or is there some sort of privacy when using cf workers
Unsmart
Unsmart13mo ago
They obviously have some level of access when required but they dont snoop into user code
dwayn
dwaynOP13mo ago
sadcowboy
Unsmart
Unsmart13mo ago
https://github.com/cloudflare/workerd/pull/1338#issuecomment-1789104894
Since dynamic code evaluation is only meant to be used by development tooling (test runner code, dev server code) I think we should be intentional about not easily exposing it to user code running within this development tooling.
Yeah this feature is only meant for dev tooling
dwayn
dwaynOP13mo ago
rip really was looking forward to using cf workers any other service you suggest with low cold start times for js? (that supports eval)
Unsmart
Unsmart13mo ago
Cloudflare offers #workers-for-platforms if you are wanting to run user code. Currently ent only but pay-go is coming at some point (and you can get early access by dm'ing the pm)
dwayn
dwaynOP13mo ago
Awesome, is skye_31 the pm?
Unsmart
Unsmart13mo ago
No the pm is tanushree
dwayn
dwaynOP13mo ago
Thank you!
Want results from more Discord servers?
Add your server