kevinmarrec/h3-typebox

Code generation from strings disallowed for this context

cosbgn opened this issue · 2 comments

cosbgn commented

When running validateBody (probably also the other helpers), it throws an error in production on vercel-edge (cloudflare workers). Most likely because they restrict certain JavaScript functions like eval(), new Function(), setTimeout([string]), and setInterval([string]), which can execute code generated from strings.

I'm not sure why these functions are needed but it would be better to avoid them.

Can you please provide a reproduction repo or create a PR that fixes that? I couldn't find any these methods in the code base, but validateBody is just a wrapper around ajv, so the core problem is probably in their implementation.

cosbgn commented