question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stellar SDK doesn't fully support HTTP2

See original GitHub issue

Stellar SDK throws an error which is an instance of Error for 404 responses with HTTP2.

Version: stellar-sdk 7.0.0

To Reproduce

Try to load an account, which does not exist.

Expected behavior

Stellar SDK should throw NotFoundError for HTTP2 404 responses.

Additional context

Status-line in HTTP 1.1 consists of HTTP-Version Status-Code Reason-Phrase(rfc2616 spec here)

BUT in HTTP2 Reason-Phrase is deprecated (rfc7540 spec here):

HTTP/2 does not define a way to carry the version or reason phrase that is included in an HTTP/1.1 status line.

JS Stellar-SDK needs status text (reason phrase) to return a correct error object. It creates an error of the NotFoundError class only if the status text is present. See the code: https://github.com/stellar/js-stellar-sdk/blob/84d10c604e4f0217c608d4019ca3e80e35584eb5/src/call_builder.ts#L382

We later check if an error is an instance of NotFoundError. Here is an example of this check in the docs: https://developers.stellar.org/docs/tutorials/send-and-receive-payments/#send-a-payment

if (error instanceof StellarSdk.NotFoundError) { ... }

There is no status text in the HTTP2 response, and we cannot properly determine what kind of error occurred (parsing an error message is not a good idea).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Shapticcommented, Jan 27, 2021

Unfortunately, the HTTP client we use under the hood doesn’t support HTTP2 yet (see axios/axios#1175). However, there may be a higher-level workaround for this. I’ll be looking closer at error-handling in a broader sense in the coming weeks so this may get lumped into it.

0reactions
Fomin2402commented, May 4, 2022

@Shaptic any news?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stellar API Reference - Stellar Documentation
The complete API reference for the Stellar network. Includes descriptions of Horizon endpoints, network concepts, and example code for some languages.
Read more >
Top 5 stellar-sdk Code Examples - Snyk
Learn more about how to use stellar-sdk, based on stellar-sdk code examples created from the most popular ways it is used in public...
Read more >
Fix USB connection issues with Ledger Live
Ledger Live no longer supports Windows 7 as Microsoft has stopped ... and browser extensions are fully closed when attempting to connect.
Read more >
API Documentation — py-stellar-base 6.1.1 documentation
Create a Asset from an XDR Asset/ChangeTrustAsset/TrustLineAsset object. Please note that this function only supports processing the following types of assets:.
Read more >
stellar-sdk - npm
stellar -sdk is a library for working with the Stellar Horizon server.. Latest version: 10.4.1, last published: 9 days ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found