cloudflare / cloudflare/cloudflare-typescript

Request error `Premature close` when using API

Open
#2,785 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
814
Forks
190
Avg merge
1h 38m
Merged PRs (30d)
2

Description

### Confirm this is a TypeScript library issue and not an underlying Cloudflare API issue

- [x] This is an issue with the TypeScript library

### Describe the bug

Getting error when using `cloudflare.pages.projects.edit`:

```
FetchError: Invalid response body while trying to fetch https://api.cloudflare.com/client/v4/accounts/***/pages/projects/: Premature close
at Gunzip. (/home/runner/work//node_modules/node-fetch/lib/index.js:400:12)
at Gunzip.emit (node:events:521:24)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
type: 'system',
errno: 'ERR_STREAM_PREMATURE_CLOSE',
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
```

### To Reproduce

Use `cloudflare.pages.projects.edit` in Node 24.17.0

### Code snippets

```TypeScript

```

### OS

Ubuntu

### Runtime version

Typescript 6.0.3

### Library version

v6.4.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing cloudflare.pages.projects.edit with Node 24.17.0, then trace the request and response handling associated with the Premature close error in the stack trace. Done means the edit request completes without ERR_STREAM_PREMATURE_CLOSE and the behavior is covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.