ajv 8.x.x doesnt work in Workers but misleadingly with works with @cloudflare/vitest-pool-workers
npm install && npm testthis passes.
Now running
npm run dev -- --port 4000and CURLing the endpoints
curl -X POST http://localhost:4000/validate \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"age": 25,
}'Fails with errors:
EvalError: Code generation from strings disallowed for this context
at [object Object]
at Ajv2.compileSchema
I tried a bunch of different options for AJV including:
code: { source: false },as recommended here