Skip to content

mattzcarey/test-ajv-workers-code

Repository files navigation

test-ajv-workers-code

ajv 8.x.x doesnt work in Workers but misleadingly with works with @cloudflare/vitest-pool-workers

Repro

npm install && npm test

this passes.

Now running

npm run dev -- --port 4000

and 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

Config

I tried a bunch of different options for AJV including:

code: { source: false },

as recommended here

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published