Skip to content

Fix/grpc empty data#10191

Draft
CurryYangxx wants to merge 2 commits into
developfrom
fix/grpc-empty-data
Draft

Fix/grpc empty data#10191
CurryYangxx wants to merge 2 commits into
developfrom
fix/grpc-empty-data

Conversation

@CurryYangxx

@CurryYangxx CurryYangxx commented Jun 30, 2026

Copy link
Copy Markdown
Member

What & Why

Fixes #8659. A gRPC response with all-default fields (e.g. an empty repeated field) serializes to a 0-byte message. Some servers still flag that frame as compressed and send grpc-encoding: gzip, so the client receives [compressed=1][length=0]. @grpc/grpc-js then feeds the empty payload to zlib, which throws unexpected end of file and surfaces in the UI as:

13 INTERNAL: Failed to decompress gzip-encoded message

Fix

Patch @grpc/grpc-js so CompressionHandler.readMessage short-circuits a zero-length payload (which unambiguously decodes to an empty message) instead of attempting decompression:

if (compressed && messageBuffer.length > 0) {
    messageBuffer = await this.decompressMessage(messageBuffer);
}

Single dispatch point → covers gzip/deflate; semantically correct since decompressing 0 bytes yields 0 bytes.

Changes

  • patches/@grpc+grpc-js+1.14.4.patch — the fix (applied via patch-package on postinstall)
  • grpc.test.ts — regression test feeding a gzip-flagged zero-length frame through CompressionFilter

Verification

Against a test server that emits [compressed=1][length=0] + grpc-encoding: gzip for empty messages:

Client Result
Unpatched grpc-js 1.14.4 ERROR: 13 Failed to decompress... (reproduces #8659)
Patched SUCCESS {"article_ids":[]}

Plus unit tests + lint passing.

Note: this is a client-side robustness fix for a non-conformant server frame. Worth reporting upstream to grpc-node so the patch can eventually be dropped.

A gRPC response whose fields are all defaults (e.g. an empty `repeated`
field) serializes to a zero-length message. Some servers still set the
compressed flag on that frame and advertise `grpc-encoding: gzip`, so the
client receives [compressed=1][length=0]. grpc-js then fed the empty
payload to zlib, which throws "unexpected end of file" and surfaced in the
UI as `13 INTERNAL: Failed to decompress gzip-encoded message`.

Patch @grpc/grpc-js so CompressionHandler.readMessage short-circuits a
zero-length payload (which unambiguously decodes to an empty message)
instead of attempting decompression. Add a regression test that feeds a
gzip-flagged zero-length frame through CompressionFilter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 30, 2026 09:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CurryYangxx CurryYangxx requested a review from yaoweiprc June 30, 2026 09:53
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

✅ Circular References Report

Generated at: 2026-06-30T10:36:59.006Z
Status: ✅ NO CHANGE

Summary

Metric Base (develop) PR Change
Total Circular References 9 9 0 (0.00%)
Click to view all circular references in PR (9)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/main/prompt-bridge.ts -> insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx
Click to view all circular references in base branch (9)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/main/prompt-bridge.ts -> insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx

Analysis

No Change: This PR does not introduce or remove any circular references.


This report was generated automatically by comparing against the develop branch.

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.

gRPC - Response with an empty array/collections - Error

2 participants