Sam Johnson
Sam Johnson

Reputation: 634

Possible to shell out from a cloudflare worker?

In google cloud functions it is easy to shell out and even run native linux binaries using child_process.execSync(command), which is how I was able to get gcf.cr to run native crystal code in google cloud functions.

Playing around with Cloudflare Workers at a glance this doesn't seem to be possible as it seems I can't even do require('child_process');.

Does Cloudflare Workers not allow shelling out? If so then it's usefulness greatly diminishes for me unfortunately.

Upvotes: 1

Views: 692

Answers (2)

Kaan
Kaan

Reputation: 5754

Adding to Zack's good answer: Cloudflare Workers currently allow HTTP outbound and that's about it.

If you need anything more than that (ex: using child processes, or TCP connections), it isn't currently possible.

Upvotes: 1

Zack Bloom
Zack Bloom

Reputation: 8417

Cloudflare Workers runs on top of V8 isolates, not a process-level container. This has several advantages, like near-instant cold starts, but means it's not possible to run arbitrary binaries.

What type of application are you hoping to run? Is it something which can be compiled to WebAssembly?

Upvotes: 2

Related Questions