-
Notifications
You must be signed in to change notification settings - Fork 62
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
Doesn't work in cloudflare workers #158
Comments
Hey @Munter, thanks for opening an issue, that's an interesting one! We'll have a look at it, in the meantime, I can suggest you having a look at ts-prismic which is a lower level Prismic client that allows you to pick your query library 🙂 cc @Duaner |
Hey @Munter, just letting you know we published @prismicio/client v6 in alpha, allowing you to provide your own fetcher function 🎉 While not documented yet the new kit has a very similar usage and comes with built-in tsdoc and an examples folder to already help you integrate with it https://github.com/prismicio/prismic-javascript/tree/aa/v6/examples |
Hey @Munter, I'm happy to announce we just released in beta @prismicio/client and @prismicio/helpers (the new @prismicio/client is now free of Cheers! |
Fixed in v6 🎉 Thank you for your contribution! https://prismic.io/docs/technical-reference/prismicio-client?version=v6 If you're still experiencing the issue with the new kit, feel free to reopen! |
This library uses cross-fetch to polyfill fetch in the environments it runs in.
However, cross-fetch is not a proper polyfill. It replaces the native
fetch
with a polyfill based onXMLHttpRequest
no whetherfetch
orXMLHttpRequest
exist or not.In Cloudflare workers you are limited to a web worker context, which has a very limited subset of javascript API available. In this environment you have
fetch
, but notXMLHttpRequest
. So cross-fetch breaks the environment by clobbering the nativefetch
with a version that throws becauseXMLHttpRequest
doesn't exist.The same thing happens if I try to run the prismic client in a web worker or a serviceworker.
See also lquixada/cross-fetch#69
The text was updated successfully, but these errors were encountered: