coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

Error: failed to get recent blockhash: TypeError: fetch failed #2938

Closed jim4067 closed 2 months ago

jim4067 commented 2 months ago

Getting the error below when running tests. Fails on devnet and localnet and testnet clusters

Error: failed to get recent blockhash: TypeError: fetch failed
    at Connection.getLatestBlockhash (/home/jimii/Documents/crew/stream-nft/node_modules/@coral-xyz/anchor/node_modules/@solana/web3.js/src/connection.ts:4593:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at AnchorProvider.sendAndConfirm (/home/jimii/Documents/crew/stream-nft/node_modules/@coral-xyz/anchor/src/provider.ts:147:9)
    at MethodsBuilder.rpc [as _rpcFn] (/home/jimii/Documents/crew/stream-nft/node_modules/@coral-xyz/anchor/src/program/namespace/rpc.ts:29:16)
      ✔ Admin initializes the protocol sate (969ms)

Env setup

solana-cli 1.17.28 (src:a67767a0; feat:3746964731, client:SolanaLabs)
anchor-cli 0.29.0

Upgrading did not help

acheroncrypto commented 2 months ago

Fails on devnet and local testnet clusters

Does it work on localnet? If so, this looks to be an RPC issue and not much we can do about that.

jim4067 commented 2 months ago

Fails on all clusters, even localnet

acheroncrypto commented 2 months ago

How do you reproduce it?

jim4067 commented 2 months ago

Running anchor test is what causes the error.

I initialized a new project and it worked fine. Not sure why it's failing on the old one though.

acheroncrypto commented 2 months ago

Closing since it's impossible to debug if it's not reproducable, and it seems to work now.

Feel free to reopen if you can reproduce it.