Skip to content

Improve HTTP Error Messaging and Handling #3398

@SimiHunjan

Description

@SimiHunjan

Description

The JS SDK supports HTTP via the gRPC web proxies. In recent cases it has been observed that these errors are not surfaced very well by the SDK itself or potentially are not being handled appropriately (i.e. stops trying a node based on error received, etc).

Here are some examples:

522 Error:

  • Hanging transactions against node 30
  • Sometimes hanging for like 40 seconds before failing with a 522
Access to fetch at 'https://node30.swirldslabs.com/proto.CryptoService/getTransactionReceipts' from origin 'https://localhost/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

504 Error:

  • The application tried to subscribe 20 attempts and gave up
  • Error subscribing to topic 0.0.1013 during attempt 17. Waiting 8000 ms before next attempt: Received HTTP status code 504
  • Error subscribing to topic 0.0.1013 during attempt 18. Waiting 8000 ms before next attempt: 14 UNAVAILABLE: Received HTTP status code 504
  • Error subscribing to topic 0.0.1013 during attempt 19. Waiting 8000 ms before next attempt: Received HTTP status code 504[Nest]
  • ERROR HCS Topic subscription error message 14 UNAVAILABLE: Received HTTP status code 504[Nest] 116
  • ERROR Error: 14 UNAVAILABLE: Received HTTP status code 504 at TopicMessageQuery._handleError
    @hashgraph/sdk/lib/topic/TopicMessageQuery.cjs:422:32) at @hashgraph/sdk/lib/topic/TopicMessageQuery.cjs:316:208 at ClientReadableStreamImpl. (/home/node/app/node_modules/@hashgraph/sdk/lib/channel/NodeMirrorChannel.cjs:71:7) at ClientReadableStreamImpl.emit (node:events:519:28) at Object.onReceiveStatus (/home/node/app/node_modules/@grpc/grpc-js/src/client.ts:612:18) at Object.onReceiveStatus (/home/node/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48) at (/home/node/app/node_modules/@grpc/grpc-js/src/resolving-call.ts:169:

The goal of this issue is to investigate the following:

  • how do we currently manage and react to HTTP errors?
  • What action do we take if any when a certain HTTP code error is received by the SDK?
  • Identify error codes that are not managed by the SDK

On a broader level, identify opportunities to make our error messaging provide enough information to the developer to understand what is going on and to have a clean way to define (1) HTTP errors (2) gRPC errors (3) SDK level errors. When errors are thrown often users ask what part of the stack is throwing the error.

Steps to reproduce

see above

Additional context

No response

Hedera network

No response

Version

latest

Operating system

None

Sub-issues

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions