Safe JavaScript Runner for Workflows (isolated V8 sandbox) avatar

Safe JavaScript Runner for Workflows (isolated V8 sandbox)

Pricing

Pay per usage

Go to Apify Store
Safe JavaScript Runner for Workflows (isolated V8 sandbox)

Safe JavaScript Runner for Workflows (isolated V8 sandbox)

Run your own JavaScript over up to 1,000 JSON records per run in an isolated V8 sandbox: no network, no require, no env vars, per-record timeout and memory limits, console.log captured. For scoring, cleaning, dedupe and routing in workflows.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Andrew Babo

Andrew Babo

Maintained by Community

Actor stats

0

Bookmarked

6

Total users

5

Monthly active users

10 days ago

Last modified

Share

Safe JavaScript Runner for Workflows

Run your own JavaScript function over a batch of JSON records inside an isolated V8 sandbox — the same way workflow tools run their "Code" step on a separate worker.

  • Isolated: every run gets a fresh V8 isolate (isolated-vm). No process, require, import, fetch, timers or environment variables. The sandbox process is started with an empty environment.
  • Per-record limits: timeout per record (default 1 s, max 5 s), 128 MB memory per isolate, 32 KB output per record, 200 log lines.
  • One bad record never breaks the batch: syntax errors, exceptions, timeouts and memory blow-ups are reported per record with a code and the line number.
  • Two modes: per_item (function runs once per record) and all_items (function receives all records — dedupe, ranking, cross-record rules).

Input

{
"code": "const size = Number(item.employee_count ?? 0);\nreturn { score: size >= 50 ? 80 : 30, keep: size >= 10 };",
"mode": "per_item",
"items": [{ "id": "r1", "company": "Acme", "employee_count": 120 }],
"limits": { "perItemMs": 1000 }
}

Output

One dataset item per input record, in input order:

{ "id": "r1", "ok": true, "output": { "score": 80, "keep": true }, "error": null, "logs": [], "ms": 1 }

Failed records carry error: { code, message, line } where code is one of code.syntax, code.runtime, code.timeout, code.memory, code.output_invalid, code.output_too_large, code.missing_output, code.batch_timeout, code.runner_crash, code.input_invalid.

A run summary (total, ok, failed, compileError, durationMs) is stored in the default key-value store under OUTPUT.