etherwallet icon indicating copy to clipboard operation
etherwallet copied to clipboard

`str.match is not a function` when trying to send from Ledger

Open tayvano opened this issue 7 years ago • 10 comments

"I’m trying to make a transaction on MEW and I’m getting this JS error in console:

8/#send-transaction:1 Error in event handler for (unknown): TypeError: str.match is not a function

I’m trying to make the transaction from my ledger nano s if that helps at all"

I've seen this elsewhere, too. There is something not being checked or validated or something correctly in the parity error messages (globalFuncs). I honestly think a if( x exists) str.match( y ) would fix it but I couldn't get it working last time I tried.

tayvano avatar May 23 '17 22:05 tayvano

Hey @tayvano, I've used MEW with my Ledger Nano S and it's working perfectly so I just want to understand how you're getting this error message?

From reading the code, I'm assuming that this is happening at https://github.com/bt/etherwallet/blob/31de5d867e4a1c740dc6af0947e445beaf5c128b/app/scripts/globalFuncs.js#L76 which I have fixed by checking that the passed in variable is a string: https://github.com/bt/etherwallet/commit/6b22fabfa9c35f2b78ead6ad7041ee04256e4f12#diff-35cde03cdca99b9096cddd10e5858a28R75

However, because I can't reproduce the error, I'm not sure how else I could fix it.

bt avatar May 25 '17 02:05 bt

To elaborate i was making a transaction using my ledger. I added the amount, address and data for the transaction and then i manually set the gas limit to 250000. I'm not sure if any of this contributed to the error. I did try a normal transaction afterwards and was repeatedly getting the same error

jefflau avatar May 25 '17 17:05 jefflau

I've realised one thing about this issue. My old mac seems to send transactions fine. I think it's my new macbook pro with touch bar has this issue. Not sure why that would make a difference. Transactions work fine if I'm using MEW without my ledger and I'm just using a normal account on my Mac.

jefflau avatar Jul 31 '17 09:07 jefflau

Very interesting.

Ill have to try on my mac w/ touchbar. We usually use the normal-USB computer w/ Ledger.

tayvano avatar Jul 31 '17 09:07 tayvano

I'm having this same issue now, @tayvano where you able to solve it?

miloops avatar Oct 17 '17 13:10 miloops

Was this issue fixed @tayvano ? I'm getting the same error and since MEW is the only application that works with ERC20 tokens on Ledger, my tokens are essentially stuck due to this bug.

Edit: This seems to be the problem. image

Update: Seems like it only happens on Windows 10, I tried on a Win 7 machine and it worked fine.

techieanant avatar Jan 07 '18 02:01 techieanant

Still haven't been able to recreate with any consistency. It was likely "solved" back when we switched from Parity to Geth and un-solved recently when we switched back to 100% parity due to geth flailing.

I will look into it again. Can you do the full console error for me @techieanant and which token you were attempting to send? I really do appreciate the screenshot.

tayvano avatar Jan 07 '18 05:01 tayvano

Have not seen it in a while. Still using a Macbook Pro with touch bar.

jefflau avatar Jan 08 '18 17:01 jefflau

I found another error today in addition to the original one while trying to get more information. Here are the steps I followed to reproduce this error:

  • Connect ledger and open Ethereum app
  • Open MEW website and access wallet
  • Click to load KIN token on the sidebar
  • Paste an address to send and set amount to send as 1000000
  • Click generate transaction to see this on the console image

Uncaught Error: new BigNumber() not a number: at raise (etherwallet-master.js:63997) at etherwallet-master.js:63986 at new BigNumber (etherwallet-master.js:62988) at Function.etherUnits.toWei (etherwallet-master.js:6549) at Scope.$scope.estimateGasLimit (etherwallet-master.js:3037) at etherwallet-master.js:2986 raise @ etherwallet-master.js:63997 (anonymous) @ etherwallet-master.js:63986 BigNumber @ etherwallet-master.js:62988 etherUnits.toWei @ etherwallet-master.js:6549 $scope.estimateGasLimit @ etherwallet-master.js:3037 (anonymous) @ etherwallet-master.js:2986 setTimeout (async) (anonymous) @ etherwallet-master.js:2985 $digest @ etherwallet-master.js:45277 $apply @ etherwallet-master.js:45542 $$debounceViewValueCommit @ etherwallet-master.js:56113 $setViewValue @ etherwallet-master.js:56090 listener @ etherwallet-master.js:52034 defaultHandlerWrapper @ etherwallet-master.js:31164 eventHandler @ etherwallet-master.js:31152

/#send-transaction:1 Error in event handler for (unknown): TypeError: str.match is not a function

Environment: Win 10 x64 Chrome Version 63.0.3239.132 (Official Build) (64-bit)

techieanant avatar Jan 09 '18 03:01 techieanant

Hi everyone,

I discovered one source for this bug. If Parity is active in your browser (e.g. if you are running "parity ui"), that will cause the str.match error message due to stuff injected by Parity. This happens deterministically for me, at least on Google Chrome on a Mac (though I don't think the operating system will matter).

You can check if Parity is active in a given browser window by opening the console -- upon page load, some Parity messages get logged to console.

Running Parity may not be the only source for this bug, but I suspect it explains at least partly why it has been so hard to reproduce.

albertni avatar Feb 22 '18 09:02 albertni