XMLHttpRequest is not defined in Netlify Functions
Open
Nobody has claimed this yet.
bug
- Dominant language
- JavaScript
- Stars
- 134
- Forks
- 87
- Avg merge
- 12m
- Merged PRs (30d)
- 25
Description
Issue Summary
XMLHttpRequest is not defined in Netlify Functions
To Reproduce
- Try to fetch content via Content API JS SDK in netlify function
I think @tryghost/content-api uses axios to send AJAX requests. Axios depends heavily on XMLHttpRequest for its functioning.
Possible alternatives can be https://github.com/developit/redaxios
Technical details:
- Ghost Version: 3.41.4
- Node Version: 12.20.1
- Browser/OS: Irrelevant
- Database: mysql
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing a Content API JS SDK request inside a Netlify Function using the reported Node.js version, then inspect how the SDK's axios-based request path depends on XMLHttpRequest. Done means the request works in Netlify Functions without XMLHttpRequest; the issue does not name specific files or tests to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100