useDApp icon indicating copy to clipboard operation
useDApp copied to clipboard

"failed to check transaction hash" errors when using Rinkeby in "Getting Started" example

Open cirenehc opened this issue 3 years ago • 12 comments

Apologies if this is an issue on my end but I spent a lot of time debugging this and not making any progress.

I created a react app using the official "Getting started" example . (same code)

The code above works for Mainnet, but as soon as I switch to Rinkeby, I'm getting spammed by the following error (hundreds per second):

failed to check transaction hash: undefined Error: invalid hash (argument="value", value=undefined, code=INVALID_ARGUMENT, version=providers/5.5.0)
    at Logger.makeError (index.ts:225)
    at Logger.throwError (index.ts:237)
    at Logger.throwArgumentError (index.ts:241)
    at Formatter.hex (formatter.ts:221)
    at Formatter.hash (formatter.ts:267)
    at Web3Provider.<anonymous> (base-provider.ts:1570)
    at Generator.next (<anonymous>)
    at fulfilled (base-provider.ts:1)

Does anyone have an idea of what's going on?

Here is my code:

import { DAppProvider, useEtherBalance, useEthers, Config, Rinkeby, Mainnet } from '@usedapp/core'
import { formatEther } from '@ethersproject/units'
import React from 'react'
import ReactDOM from 'react-dom'

const config: Config = {
  readOnlyChainId: Rinkeby.chainId,
  readOnlyUrls: {
    [Rinkeby.chainId]: 'https://rinkeby.infura.io/v3/383bd90f028a44279e65d3a839f3cec3',
  },
}

ReactDOM.render(
  <React.StrictMode>
    <DAppProvider config={config}>
      <App />
    </DAppProvider>
  </React.StrictMode>,
  document.getElementById('root')
)

export function App() {
  const { activateBrowserWallet, account } = useEthers()
  const etherBalance = useEtherBalance(account)
  return (
    <div>
      <div>
        <button onClick={() => activateBrowserWallet()}>Connect</button>
      </div>
      {account && <p>Account: {account}</p>}
      {etherBalance && <p>Balance: {formatEther(etherBalance)}</p>}
    </div>
  )
}

cirenehc avatar Dec 29 '21 16:12 cirenehc

same error on polygon

ankhaaa1 avatar Jan 01 '22 14:01 ankhaaa1

i have the same issue. it seems network specific

devnobi avatar Jan 02 '22 17:01 devnobi

The problem has reappeared and is now happening all the time. Clearing the cache doesn't help anymore. The entire application stops responding due to the number of calls/errors.

Has anyone managed to find a solution?

~~I had a similar issue. Here's another one: https://github.com/EthWorks/useDApp/issues/430.~~

~~I can confirm that clearing local storage (Firefox, but it probably doesn't matter) has solved the problem. I can't reproduce it now. I also have multiple projects in my local environment, so maybe it's just some conflict between data from these projects. 🤷‍♂️~~

eshlox avatar Jan 07 '22 11:01 eshlox

I'm getting the same problem suddenly. 25 calls over and over. Any updates?

jboetticher avatar Jan 16 '22 00:01 jboetticher

@tt-marek Could anyone help us with this issue? 🙏 We can't use the framework because of it. We cannot develop projects without using a test network. 😉 Thanks!

eshlox avatar Jan 17 '22 21:01 eshlox

OK, clearing the local storage helps. I had 200+ transactions in local storage (transactions key). It looks like the framework tried to get a transaction receipt for each transaction, but the transaction hash was null. Should we clean up transactions if they fail? I need to figure out why I had so many transactions in local storage. 🤔

eshlox avatar Jan 18 '22 13:01 eshlox

@eshlox For now, at least, clearing the local storage stopped the error spamming, thank you

gabrieljim avatar Jan 20 '22 13:01 gabrieljim

I'm sorry for a dumb question, but how do I clear the local storage?

NarithChesda avatar Mar 30 '22 06:03 NarithChesda

It is solved, so i close that issue.

mj426382 avatar Jun 08 '22 16:06 mj426382

@mj426382 Pardon me, but it looks like it hasn't been solved in Rinkeby testnet, any hints on where should I look in order to solve this?

OleksandrRabchuk avatar Aug 01 '22 10:08 OleksandrRabchuk

@OleksandrRabchuk Can you help me to reproduce it? Are you perhaps able to get to this error starting in an incognito mode or a fresh browser profile?

rzadp avatar Aug 01 '22 13:08 rzadp