Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: opt out of response compression to avoid Node 24+ fetch gzip bug#62

Draft
lmjabreu wants to merge 1 commit intomainDoist/outline-cli:mainfrom
fix/node-24-gzip-fetchDoist/outline-cli:fix/node-24-gzip-fetchCopy head branch name to clipboard
Draft

fix: opt out of response compression to avoid Node 24+ fetch gzip bug#62
lmjabreu wants to merge 1 commit intomainDoist/outline-cli:mainfrom
fix/node-24-gzip-fetchDoist/outline-cli:fix/node-24-gzip-fetchCopy head branch name to clipboard

Conversation

@lmjabreu
Copy link
Copy Markdown

@lmjabreu lmjabreu commented May 8, 2026

Summary

  • Fix ol auth status (and the OAuth login flow's auth.info step) failing on Node 24+ with Unexpected token '...' is not valid JSONres.json() was choking on raw gzipped response bytes.
  • Send Accept-Encoding: identity on every API request so the server returns an uncompressed payload, sidestepping whatever decompression path Node mishandles.

Background

Same family of bug as Doist/twist-sdk-typescript#126. That PR framed it as "only with a custom undici dispatcher", but ol reproduces the symptom on Node 26 against handbook.doist.com using bare fetch with no custom dispatcher. The smallest robust fix is the same one the SDK landed on: opt out of response compression entirely. Cost is uncompressed JSON, negligible for this CLI's small payloads.

Test plan

  • npm run type-check
  • npm test — 77/77 passing (api.test.ts header assertion updated)
  • npm run build && node dist/index.js auth status against handbook.doist.com on Node 26 — prints team/user (was failing pre-fix)
  • ol auth login --token <token> end-to-end on Node 26 (token-flow exercises the same apiRequest path)

🤖 Generated with Claude Code

On Node 24+, global `fetch` can return raw gzipped bytes for compressed
responses, which breaks `res.json()` with "Unexpected token '...' is not
valid JSON". Reproduced on Node 26 against handbook.doist.com via
`ol auth status` and the OAuth login flow's `auth.info` call.

Send `Accept-Encoding: identity` so the server returns an uncompressed
payload, sidestepping the issue across Node versions. Mirrors the fix
landed in twist-sdk-typescript#126.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.