TryGhost / TryGhost/SDK

XMLHttpRequest is not defined in Netlify Functions

Open
#370 4 comments 0 reactions 0 assignees View on GitHub

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
  1. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.