XMLHttpRequest is not defined
See original GitHub issue- Node Version: v7.5.0
- Npm Version: 4.1.2
- Platform: MacOS
- Package Version: contentful v4.1.1
Running the code below in the node environment:
const contentfulClient = contentful.createClient({
space,
accessToken: key
});
contentfulClient.getEntries({
content_type: 'article',
select: 'fields',
})
.catch(e => console.error(e))
.then(entries => {
console.log(entries.items);
})
triggers the error:
ReferenceError: XMLHttpRequest is not defined
at dispatchXhrRequest (/node_modules/contentful/dist/contentful.js:1671:23)
There are no other dependencies or transpilers. Just one file with the above-mentioned code.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
XMLHttpRequest module not defined/found - Stack Overflow
XMLHttpRequest is a built-in object in web browsers. It is not distributed with Node. The http module is the built-in tool for making...
Read more >Node.js - ReferenceError: XMLHttpRequest is not defined
Attempting to run the following JavaScript code (an AJAX call using XMLHttpRequest) throws a ReferenceError under Node, but works in a web browser....
Read more >XMLHttpRequest is not defined - Replit
trying to create a new XMLHttpRequest object but the console shows: ReferenceError: XMLHttpRequest is not defined at /home/runner/ajax/index.js:1:17
Read more >ReferenceError: XMLHttpRequest is not defined #15040
Hi all,. I'm trying to connect to the Solana blockchain via a Deno http server. This is my code: import { serve }...
Read more >Getting ReferenceError: XMLHttpRequest is not defined
When I am trying to authenticate client using Javascript SDK I am getting the above ReferenceError: XMLHttpRequest is not defined.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh wow, for some reason axios thinks it is running in the browser, I will try to fix this asap. Sorry about that
Thank a lot for the report @maximus8891 this is now fixed in https://github.com/contentful/contentful.js/pull/132 a new patch version will be out in few minutes