-
Notifications
You must be signed in to change notification settings - Fork 201
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
Contentful JS library doesn't work in nextjs edge runtime #2051
Comments
Hi @RProduction, |
|
Super confused about how to get the previewClient to work on edge runtime. I tried all the suggestions but it just fetches the original blog post. |
It should work now with v11! Can you all please give it a test and let me know if it worked? @RProduction @MickL @Meagsy |
How did you solve it? Personally I would have suggested to use https://github.com/unjs/ofetch |
@MickL the plugin is updated and restructured, now delivers proper modern JS (plus fallback to common JS for older systems) We can not (yet) replace axios, but you can always use axios fetch adapter if you need fetch to be used in the background: |
In my opinion Axios should be removed. I would like to integrate Contentful as a headless CMS in my projects but I dont want to bloat my code with another http library. We use Nuxt in most of our projects which uses ofetch, a simple wrapper around fetch that works in Browsers, Node and Edge Workers. I know that Next.js also puts a wrapper around native fetch, but it is not a public reusable library like ofetch, as far as I know. |
Expected Behavior
It should return entry object
Actual Behavior
Console log shows
[Error: Adapter 'http' is not available in the build]
Possible Solution
Provide fetch API from contentful library
Steps to Reproduce
Context
Environment
The text was updated successfully, but these errors were encountered: