Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Uncaught rejection on RPC request #3236

Closed
iprotoni opened this issue Sep 11, 2024 · 2 comments
Closed

Error: Uncaught rejection on RPC request #3236

iprotoni opened this issue Sep 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@iprotoni
Copy link

Overview

Whenever an RPC request encounters an error, it results in an uncaught rejection. This means that even if the outer call is wrapped in a try-catch block, the error cannot be caught and handled properly.

Steps to reproduce

  1. Make an RPC request using the solana-web3.js library.
  2. Force an error condition for the request.
  3. Wrap the request call in a try-catch block.
  4. Observe that the error is not caught by the try-catch block and results in an uncaught rejection.

Description of bug

There is an issue in the packages/library-legacy/src/connection.ts file at line 1679. Whenever an RPC request encounters an error, it results in an uncaught rejection. This means that even if the outer call is wrapped in a try-catch block, the error cannot be caught and handled properly.

Expected Behavior:

The error should be caught and handled properly within the try-catch block surrounding the RPC request call.

Actual Behavior:

The error results in an uncaught rejection, bypassing the try-catch block.

Proposed Solution:

Add a try-catch block around the RPC request in packages/library-legacy/src/connection.ts at line 1679 to handle errors properly and prevent uncaught rejections.

@iprotoni iprotoni added the bug Something isn't working label Sep 11, 2024
@buffalojoec
Copy link
Collaborator

Duplicate of #2933. As mentioned in the discussion on #2933, we'll need a true reproduction of the issue. I wasn't able to repro with a test.

It's also possible it's not related to Web3.js, but rather the callback function from a dependency. See discussion here.

@steveluscher
Copy link
Collaborator

Feel free to reopen this when you have a chance to create a repro case.

@steveluscher steveluscher closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants