How to debug "EvalError: Code generation from strings disallowed for this context"

Im aware that this is caused by eval and new Function. i moved my entire validation to https://www.npmjs.com/package/@cfworker/json-schema because i thought it was that. but it wasnt im using worker assets with sveltekit. i checked the _workers.js but its really small and no eval or new Function there
npm
@cfworker/json-schema
A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, 2019-09, and 2020-12.. Latest version: 4.1.1, last published: 24 days ago. Start using @cfworker/json-schema in your project by running npm i @cfworker/json-schema. There are 31 other projects in the npm registry using @cfworker/json-schema.
3 Replies
DaniFoldi
DaniFoldi2w ago
Can you share a git repo, or the _worker.js? unfortunately without seeing your worker, or the bundled file, the best answer I can give is that somewhere in your code there is still an eval/new Function
Silvan
SilvanOP7d ago
i did figure it out eventually it was another library using an unsupported validator. even tho i could not find a single eval/new Function in my build code would be very cool if it was possible to have some sort of stacktrace that might indicate the library causing the issue. but thanks!
DaniFoldi
DaniFoldi7d ago
glad you got it resolved! :MeowHeartCloudflare:

Did you find this page helpful?