@tryghost/admin-api SDK broken on Google Cloud and Deno, fix available

The @tryghost/admin-api package version 1.13.2 is broken in the Google Cloud environment and also with the Deno TypeScript/JavaScript environment.

The issue is a typing bug. The default type of a body of a GET request is given as empty object. But strictly, an HTML body is not allowed with a GET request, even if it is an empty JSON object, and the typing enforces that by throwing an error:

error: Uncaught TypeError: Request with GET/HEAD method cannot have body.

As far as I can tell, the admin-api package doesn’t actually try to send a body to a GET request besides an empty object, so the fix is simple: Change the default value of the body sent to a GET request from an empty object to either an empty string or “undefined”.

This 3-character patch was submitted over a year ago and now two other Ghost users have provided peer-review both that they experienced the problem and that the patch fixes it. The PR is here:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.