Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

【confirmTransaction】 push an error on alchemy : Unsupported method: ping. See available methods at https://docs.alchemy.com/alchemy/documentation/apis #2018

Closed
shifenhutu opened this issue Jan 9, 2024 · 3 comments
Labels
question Add this to close an issue with instructions on how to repost as a question on Stack Exchange

Comments

@shifenhutu
Copy link

shifenhutu commented Jan 9, 2024

Overview

when i use sendAndConfirmTransaction , i sometimes can't got the transaction status , then i enter https://dashboard.alchemy.com/logs/ , it throw an error:

image

{
  "jsonrpc": "2.0",
  "id": 0,
  "error": {
    "code": -32602,
    "message": "Unsupported method: ping. See available methods at https://docs.alchemy.com/alchemy/documentation/apis"
  }
}

Steps to reproduce

i think the bug maybe from confirmTransaction , so i create a lillte demo, to reproduce the bug

here is my code:

https://codesandbox.io/p/sandbox/romantic-bohr-tr496j?file=%2Fsrc%2Findex.js
【you need replace your alchemy key in the rpcUrl

when i click the buton , i got error in https://dashboard.alchemy.com/

Description of bug

the api confirmTransaction can't wait the transanction status , i say the api is deprecated, #792 but i found it in the source https://github.com/solana-labs/solana-web3.js/blob/master/packages/library-legacy/src/connection.ts#L3734

are we deprecated it ?


thank you very much

i am so sorry for that i am not good at english

========

chinese version [中文版]:

我在使用 sendAndConfirmTransaction 发送交易的时候,经常 等不到交易,经常超时,我增加了超时时间,还是会出错

我的节点用的是 alchemy的, 在 alchemy的后台,我查看了日志,报错是
image

经过简单排查,我发现 是 api confirmTransaction 导致了这个超时

我创建了一个最小的demo,来复现这个错误 https://codesandbox.io/p/sandbox/romantic-bohr-tr496j?file=%2Fsrc%2Findex.js

[使用demo的时候,需要把 变量 rpcUrl 里的 key 替换为 你在 alchemy的 key]

点击 demo里的按钮,会发起一个查询 交易的请求, 这个请求极大概率, 99%的概率, 会在 alchemy 报错

@shifenhutu shifenhutu added the bug Something isn't working label Jan 9, 2024
@buffalojoec
Copy link
Contributor

Hello, so I've noticed a few things here, but this is not a bug with Web3.js, so it doesn't belong here.

First of all, the error you've posted here is telling you that ping is not a method supported by Alchemy's RPC.

Unsupported method: ping. See available methods at https://docs.alchemy.com/alchemy/documentation/apis

You need to use a method that's actually supported by the RPC.

As far as confirming the transaction goes, you're using an old transaction that has long been confirmed/finalized. The method confirmTransaction(..) is designed to subscribe to signatures to receive a notification when the transaction with the given signature reaches the specified commitment level.

Since your transaction is already finalized, it's never going to get a notification that it's confirmation status has changed.

https://docs.solana.com/api/websocket#signaturesubscribe

@buffalojoec buffalojoec added question Add this to close an issue with instructions on how to repost as a question on Stack Exchange and removed bug Something isn't working labels Jan 9, 2024
Copy link
Contributor

github-actions bot commented Jan 9, 2024

Hi @shifenhutu,

Thanks for your question!

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of the Solana JavaScript SDK itself.

Questions like yours deserve a purpose-built Q&A forum. Unless there exists evidence that this is a bug with the Solana JavaScript SDK itself, please post your question to the Solana Stack Exchange using this link: https://solana.stackexchange.com/questions/ask


This automated message is a result of having added the ‘question’ tag.

@github-actions github-actions bot closed this as completed Jan 9, 2024
Copy link
Contributor

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Add this to close an issue with instructions on how to repost as a question on Stack Exchange
Projects
None yet
Development

No branches or pull requests

2 participants