-
-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow it to work on edge (e.g. cloudflare workers) #2491
Comments
I see, so the use of AJV within other projects preclude those projects from being used in cloudflare. I wonder if it would be possible for those projects to pre-build any schema based validations functions so that their code can be run on cloudflare? It won't always be possible but not out of the question depending on the usage. I say this because given how AJV works I can't think of a way to avoid using Anyway, I am open to ideas but afaik we couldn't stop using |
No, since the source files are fetched at runtime, there’s bo way to pre-build. |
I see. Well I will leave this open. If anyone has any ideas on how to work around this or any proposals, we can discuss it. |
As Cloudflare doesn't allow |
Thanks for the info @Justineo, I will keep an eye out for that. |
There is already an issue for this , #2318, but it is closed. Suggestion there is not working when ajv is XX-layers down like eg: async-parser -> @stoplight/spectral->ajv and dynamic schema is validated, there is not visible to generate and pass validation function all the way down.
The version of Ajv you are using
latest
The environment you have the problem with
cloudflare worker
Your code (please make it as small as possible to reproduce the issue)
standard example from async-parser Example
Works in every browser and node env, except of cloudflare worker.
Results and error messages in your platform
If there is no way to drop
new Function
usage in general, maybe it could be made conditional? let's say ifoption.workerSafe
is passed as true, do something worker safe instead of new function?The text was updated successfully, but these errors were encountered: