trezor / connect

:link: A platform for easy integration of Trezor into 3rd party services
Other
348 stars 262 forks source link

Metamask + Trezor pop up window automatically closes without signing #784

Open ChooChooCC opened 3 years ago

ChooChooCC commented 3 years ago

When the pop up window shows up for me to sign transactions (the part where there is a green circle waiting to load), the window automatically closes before I can sign anything, and in my metamask activity it says "Failed, send X coin".

prusnak commented 3 years ago

Which OS are you using? Which browser are you using?

ChooChooCC commented 3 years ago

Mac and brave. The workaround I found is to downgrade to firmware 2.3.0, and reset the metamask and clear my browser cache, now it works with the older version.

prusnak commented 3 years ago

Brave is not supported. Please, try if this works in Chrome.

SophieElle commented 3 years ago

I also use the brave browser and had problems confirming a certain transaction for weeks for the same reason.

Then it worked. I used the Trezor suite (beta version) for this.

And now it does not work AGAIN. What could be the reason for this?

The problem: the metaMask wallet I use is connected to the BraveBrowser. I can NOT open this particular wallet anywhere else because of Trezor, as I do not have the private key! :(

so I urgently need your help for this problem

bradwbradw commented 3 years ago

@prusnak it's also broken in Chrome. I'm also a Brave user, but I just tried connecting the Trezor to Metamask in Chrome so that I can test, but the popup closes immediately before signing, and then the metamask page is stuck on the "Looking for your Trezor" screen

Screen Shot 2021-05-27 at 3 08 57 PM

Im using: OS: MacOS 10.15.7 Hardware Wallet: Trezor 1.10.0 Browser: Chrome Version 91.0.4472.77 (Official Build) (x86_64) MetaMask Version 9.5.5

issue at Metamask: https://github.com/MetaMask/metamask-extension/issues/10896

szymonlesisz commented 3 years ago

@bradwbradw do you have any popup blocker installed like Adblock, privacy Badger etc?

bradwbradw commented 3 years ago

hey @szymonlesisz , I just disabled adblock, and turned off "pops up and redirects allowed" in chrome, restarted Chrome and tried again, but the problem still persists. This time, i did see the error "Device call in progress" in the metamask UI

prusnak commented 3 years ago

@bradwbradw Please, try the same thing in the Incognito mode of Chrome.

szymonlesisz commented 3 years ago

could you pls describe what you are doing step by step, bc. im not able to reproduce the issue. From what i understand you are able to "connect hardware wallet" but you are not able to "sign transaction", is that right? are you trying to send regular ETH or ERC20 token?

bradwbradw commented 3 years ago

I am unable to connect the hardware wallet again after I had removed it while trying to work around the issue.

@prusnak When I click on "connect hardware wallet" in incognito mode, it just opens up a new window with the chrome-extension://.../home.html#new-account/connect url in regular Chrome, and the same problem happens.

@szymonlesisz for steps, go to: https://github.com/MetaMask/metamask-extension/issues/10896#issue-860433243

szymonlesisz commented 3 years ago

i guess this will require additional debugging so i need to ask you to do the following:

  1. go to chrome://extensions/
  2. disable MetaMask extension
  3. enable "developer mode" (top right corner)
  4. enable MetaMask, now you should see additional option "inspect views", click on "background.html" Screenshot from 2021-05-28 15-36-17
  5. in opened console write: window.__TREZOR_CONNECT_SRC='https://connect.trezor.io/8/'; This will enable additional logs from trezor-connect. Screenshot from 2021-05-28 15-39-28
  6. try to "connect hardaware wallet", you should see a lot of logs like: Screenshot from 2021-05-28 15-42-42
  7. right-clik on the logs and "save as", then DM me the result (szymon.lesisz@satoshilabs.com) dont worry it should not contain any private data at this point
bradwbradw commented 3 years ago

alright, I DM'd you the logs.

faxotherapy commented 3 years ago

Does anyone know a workaround to this issue? Because, in the mean time, Trezor no longer works with MetaMask. Pop-up window always unexpectedly closes before allowing me to do anything on Trezor. That's the huge impediment as it prevents me from interacting with any DeFi app. Again, on Polygon, issue still persits. I'm not keen at all at moving my funds on MM. Thank you.

ChooChooCC commented 3 years ago

@faxotherapy the workaround I found is that I downgraded the firmware 2.3.0 (for model T) and it works. I have been using this firmware version for a few month and it works fine.

bradwbradw commented 3 years ago

Using a Trezor One firmware v1.10.0, I'm able to use it with Metamask on Windows 10 Firefox, but not at all on Mac Catalina (Chrome or Firefox)

I also tend to change networks frequently too, between Matic, Binance Smart Chain, Fantom and Eth. I don't know if this has anything to do with the problem.

On Fri, Jun 4, 2021 at 1:39 PM ChooChooCC @.***> wrote:

@faxotherapy https://github.com/faxotherapy the workaround I found is that I downgraded the firmware 2.3.0 and it works. I have been using this firmware version since.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trezor/connect/issues/784#issuecomment-854986334, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD7F5F35DBV5SCSKICLJVLTRE2ZTANCNFSM4ZR6KTYQ .

onetwoitsthewu commented 3 years ago

I am also having major issues with my Model T (firmware 2.3.6) with Metamask. If/when the popup does appear after making transaction request, it tells me that my Trezor device is inactive and that it is being used by another application. When I click on activate, either the pop-up will close and give me the "device was disconnected" error or it will forever spin the "loading" message and then time out saying "unable to claim interface." other times, the transaction just gets stuck in MM, but not appear as pending on etherscan so i have to manually "reset account" in MM to get rid of the stuck txns. is this a firmware issue, as this just started happening recently? any ideas on how to remedy? all of my crypto is effectively stuck at the moment which is no bueno.

darkwing commented 3 years ago

I was seeing my Trezor popup window closing upon an attempt to send today, with the following error: "Forbidden key path"

A quick Google search shows it appears it could be a firmware issue, but I haven't followed the provided steps to ensure they work.

Edit Removed link that I've not verified works to fix the issue.

prusnak commented 3 years ago

A quick Google search shows it appears it could be a firmware issue, but I haven't followed the provided steps to ensure they work.

It's not a firmware issue. It's an issue of a caller (Metamask) using the wrong path for selected coin (i.e. not using m/44'/60' for Ethereum or m/44'/1' for any of the Ethereum testnet networks).

szymonlesisz commented 3 years ago

I'm really trying to reproduce this but with no luck. i'm just able to connect every time. there must must be something specific in your configuration and i don't know what it is...

my setup:

macOS Catalina 10.15.15 Metamask 9.5.9 Chrome 91.0.4472.77 - with and without adblock + privacy badger enabled Brave 1.25.70 (chromium 91.0.4472.77)

Trezor 1.10.0 and 2.3.6 Trezor Bridge 2.0.27

i even tried it with older setups: older browsers, older MM extensions, older firmwares, custom firmwares, webusb - before chrome 91...

@trezor/qa pls help me out here

ChooChooCC commented 3 years ago

@szymonlesisz Did you try reproduce that in alternative network other than ethereum mainnet like BSC, xDai, or Matic? I remember that's when it was failing for me.

prusnak commented 3 years ago

@szymonlesisz Did you try reproduce that in alternative network other than ethereum mainnet like BSC, xDai, or Matic? I remember that's when it was failing for me.

Then you are just confirming my words from above:

It's not a firmware issue. It's an issue of a caller (Metamask) using the wrong path for selected coin (i.e. not using m/44'/60' for Ethereum or m/44'/1' for any of the Ethereum testnet networks).

Each coin has assigned path - https://github.com/satoshilabs/slips/blob/master/slip-0044.md - and no other path should be set.

I am almost confident it is this issue, because downgrade to 2.3.0 (where we did not check the paths) seems to fix the issue.

Metamask should catch error from Connect and show it in their UI, so it seems there are two issues with Metamask:

faxotherapy commented 3 years ago

MetaMask has gone too far on this issue. I will never ever again use MetaMask with Trezor. It simply is dangerous. It's totally unreliable. I'm currently in a leveraged position on Instadapp and I cannot unwind it, because I'm not offered to confirm on my Trezor after clicking on the Confirm button on MM pop-up window.

szymonlesisz commented 3 years ago

Instead of downgrading the firmware you can try to temporary disable safety checks mentioned by @prusnak to see if that helps. Trezor will warn you about using invalid slip44 path. This may help us to narrow down the issue which networks are using invalid paths in metamask.

  1. go to https://suite.trezor.io/web/settings/device/
  2. click on "edit" safety checks Screenshot from 2021-06-10 06-04-47
  3. set to "prompt" and confirm on Trezor Screenshot from 2021-06-10 06-05-27
faxotherapy commented 3 years ago

MetaMask has gone too far on this issue. I will never ever again use MetaMask with Trezor. It simply is dangerous. It's totally unreliable. I'm currently in a leveraged position on Instadapp and I cannot unwind it, because I'm not offered to confirm on my Trezor after clicking on the Confirm button on MM pop-up window.

I'm going to reply to myself. The issue seems to happen erratically. When it happens, one should try any combination of the following: close dApp tab/window (or quit/restart Firefox), Lock MM (then re-open it), switch network back and forth (e.g. Ethereum ⇌ Polygon), unplug/replug Trezor (if necessary, connect Trezor directly to USB port), clear cookies/cache for the dApp tab/window, sometimes opening MM in a tab first, and interacting with the MM tab instead of the MM pop-up window help.

The thing I understand is why any two or three of the combination above help solve the issue, at least temporarily.

faxotherapy commented 3 years ago

Instead of downgrading the firmware you can try to temporary disable safety checks mentioned by @prusnak to see if that helps. Trezor will warn you about using invalid slip44 path. This may help us to narrow down the issue which networks are using invalid paths in metamask.

1. go to https://suite.trezor.io/web/settings/device/

2. click on "edit" safety checks
   ![Screenshot from 2021-06-10 06-04-47](https://user-images.githubusercontent.com/3435913/121463242-fd3d9d00-c9b1-11eb-8e88-b189f4c924e2.png)

3. set to "prompt" and confirm on Trezor
   ![Screenshot from 2021-06-10 06-05-27](https://user-images.githubusercontent.com/3435913/121463280-12b2c700-c9b2-11eb-9df1-ecbddb863323.png)

Don't really know whether the suggestion is addressed to me or not. If so, I'm a bit scared to break everything in my Trezor with these steps. Is it some kind of a debugging process for Trezor?

bosomt commented 3 years ago

I was able to reproduce and solve issue via Suite 21.6.1

As soon you change device setting via https://github.com/trezor/connect/issues/784#issuecomment-858283219 you can send transactions. Metamask was reporting Forbidden key path browser console.

Info:

STew790 commented 3 years ago

I can confirm what @bosomt wrote. With disabled safety checks, I was able to send a transaction. With enabled safety checks, i got the same error message.

Info:

szymonlesisz commented 3 years ago

@faxotherapy it was addressed to anyone having this issue

don't worry you will not break anything. instead of receiving error (Strict full security) you will be prompted, asked for confirmation on device that the app (metamask) is trying to use incorrect/unknown derivation path (not assigned to requested coin by bip44 standard)

Screenshot from 2021-06-10 15-25-16 Screenshot from 2021-06-10 15-27-05

like @prusnak said: downgrading to 2.3.0 helps only because this "safety check" was not implemented back then and even incorrect paths was allowed

szymonlesisz commented 3 years ago

of course it would be better to have "safety checks" enabled (you can enable them back after you send your coins)

but since your assets are locked in metamask, this is the way how to work with them again following @prusnak

Metamask should catch error from Connect and show it in their UI, so it seems there are two issues with Metamask:

    they are not using the correct paths for coins they use
    they are not showing the error Connect returns ("Forbidden key path")
bradwbradw commented 3 years ago

It's not a firmware issue. It's an issue of a caller (Metamask) using the wrong path for selected coin (i.e. not using m/44'/60' for Ethereum or m/44'/1' for any of the Ethereum testnet networks).

Each coin has assigned path - https://github.com/satoshilabs/slips/blob/master/slip-0044.md - and no other path should be set. ...

  • they are not using the correct paths for coins they use
  • they are not showing the error Connect returns ("Forbidden key path")

@prusnak, thanks for this resource. I'm just curious as to why it would work erratically (or in my case, it is working fine in Windows with Firefox) if MM is making calls using the wrong derivation path? How could it ever work if Metmask uses the "incorrect path" for an Ethereum-based coin?

I'm still learning here so bear with me... but I would have assumed the same path is used for any network that supports the Ethereum standard. If that's not the case, how does MetaMask know what path to use, if the only configurable difference is basically the RPC url and the Chain ID?

The BIP44 doc describes using different addresses for each coin, but I believe most Metamask users use the same address across ETH, BNB, MATIC, etc... that's kind of the whole point of cross-chain defi, and it's how tools like xpollinate and multichain works for transferring funds between coins.

bradwbradw commented 3 years ago

I just tried right now again with my Mac / Brave setup and I'll just describe exactly what I'm doing, hopefully it helps some developers working for Trezor or Metamask. I had already removed Metamask entirely, so this is a "clean slate" for repro steps purposes.

I came here to try out the workaround, but I think it's only for Model T, whereas I'm using Trezor One. I don't see "edit safety checks" anywhere at https://suite.trezor.io/web/settings/device/

I'm now going to try to harvest krill one more time to see what the error is in trezor-connect (following https://github.com/trezor/connect/issues/784#issuecomment-850435249) When I opened background.html, i see

Screen Shot 2021-06-10 at 7 14 19 PM

When I try to harvest more krill, the popup disappears before signing, but there are no more log events in this window.

szymonlesisz commented 3 years ago

(...) it is working fine in Windows with Firefox (...) How could it ever work if Metmask uses the "incorrect path" (...) whereas I'm using Trezor One. I don't see "edit safety checks" anywhere

@bradwbradw We are dealing with different configurations/cases here but i'm pretty sure that the reason is still the same -> MetaMask is not handling errors well (or not handling at all) in their UI.

In your case (Trezor 1.10.0) there are no "safety_checks"[1] -> you are getting error different than "Forbidden key path", it may not even be related to trezor-connect as i saw in your logs, but this error is interrupting the process and it's not handled/shown in MetaMask UI. I suppose macOS an Windows browsers reacts differently for not handled errors. Windows is ignoring them while macOS interrupts running code (?) just a guess.

"Device used in another window" error in connect means that some app opened USB port to read/write but didn't close it properly (interruption) and connect is thinking that different app is talking to Trezor right now.

_[1] "Safetychecks" were added in 1.10.1, released on wednesday, if you update your FW they will be there

szymonlesisz commented 3 years ago

how does MetaMask know what path to use, if the only configurable difference is basically the RPC url and the Chain ID

they don't and this is why they are using invalid path. for example mentioned MATIC according to slip44 should be used with path m/44'/966'/0' and chainId 137 but its used with ETH path m/44'/60'/0' and chainId 137

example:

address derived from m/44'/966'/0'/0/0 (matic) is 0x245d740739078b7A87131C0d1b7020D1BE2Fd971 while address derived from m/44'/60'/0'/0/0 (eth) is 0xc03F9C5A337225Db085947cDD8e221a30A42079A

from what i saw MetaMask is using the same addresses for every possible network (predefined or custom) which is quite unfortunate, because other wallets which are respecting slip44 will derive those addresses differently -> will not show you your MATIC balance since its sent to a different/unexpected address

like for example mycrypto.com Screenshot from 2021-06-11 11-51-33

szymonlesisz commented 3 years ago

try again to harvest more KRILL

KRILL is another story, there is no KRILL here: https://github.com/ethereum-lists/chains or here: https://github.com/satoshilabs/slips/blob/master/slip-0044.md

so technically KRILL is not supported. Maybe this is the reason why signing KRILL transaction fails and even if MetaMask is showing you that it is pending in reality it's not there.

Again, looks like the same issue: MetaMask didn't handle signing error and assuming that was signed properly is showing you tx as "pending"

bradwbradw commented 3 years ago

this problem went away for me when i updated OS to Big Sur

mrkaqz commented 3 years ago

Hi, I am also have very difficult to approve spend on the Metamask + Terzor model T.

The popup is just show flash and close without asking me to export public key or do anything. I have to close browser and repeat the process again until it randomly work sometime.

Anyone can help me on this?

aloceros commented 3 years ago

I have reproduced this issue across multiple devices. I also have devices where it never occurs. There is something configuration specific. But I can confirm that it is definitely not related to the safety checks. Those reporting safety checks have a different issue. The problem of the popup closing immediately does not trigger any error in the console.

aloceros commented 3 years ago

I have reproduced this issue on a vanilla Chromebook. Literally ChromeOS + MetaMask + Trezor is the entire setup. If the bug occurs in this environment I don't think it can be blamed on the configuration of other software.

markg31 commented 3 years ago

I have the same issue, my eth are stuck on metamask/trezor wallet. I' m using trezor one and windows 10, anyone have solved the issue yet?

HeroHann commented 3 years ago

As the other issue was closed... Is Trezor working with Metamask to solve this? @prusnak And or should I open an issue for metamask and link this?

prusnak commented 3 years ago

Is Trezor working with Metamask to solve this? @prusnak And or should I open an issue for metamask and link this?

Reported here: https://github.com/MetaMask/metamask-extension/issues/10896

mickmastermike commented 2 years ago

Hi, I am having the same issue. Metamask linked to my Trezor Model one! When i try and sign a transactions 99% of the time the Trezor pop up window appears for some 2 seconds and disappears again. I have tried everything i could, reinstall metamask, updated everything to the latest versions, cleared the caches, deleted browsing history etc. A few months back it did this some 1/10 times,and after a log out of metamask and sometime a pc restart the issue was solved. But it appears to be getting worse and worse, sometimes it takes me almost 2 hours just to approve 2 transactions, and as you can imagine trying to claims rewards on various farms etc, its a rather tiring task to perform. Any help on the matter would be most appreciated. Cheers! M

lawrenzpng commented 2 years ago

Hi, I'm having the similar experience with my Trezor model one for few weeks now, unable to sign for any transaction via my Metamask wallet. It was working fine a month ago but now once I get to the screen to key in passphrase and confirmation screen, nothing happen. Previously there's one more screen to click proceed but this time that screen is missing and I was left with no respond whatsoever. I'm not sure if there's any pop up window closes within split second that i'm not aware of, I'd tried turning it off to test but without any luck. Appreciate if there's further update on this issue as all my assets were stuck. Thanks.

lostintime101 commented 2 years ago

Suffering exactly these issues also. Works sometimes and other times not. Restarting can help but not always. The popup flashes for a second and then is gone. All attempts to recover it fail and you're just left hanging with a failed transaction and 70 dollar gas fees charge.

Newish Windows 10 laptop with Chrome, Trezor One + Metamask.

This is such a terrible experience that I created an account here just to leave this comment. It's that frustrating.

alexruzenhack commented 2 years ago

I have had the same issue with Chrome 95.0.4638.??. After restarting to update the Chrome version to 95.0.4638.54 it worked. Then I sent all the tokens to another wallet on MetaMask without connection with Trezor model T. For now, I will be far from this setup. However, for BSC it works like a charm.

faxotherapy commented 2 years ago

Well, in my case, I decided to buy a Ledger. Not at all a fan of this company, but decided to be more humble, put my pride out of my way, and buy their product so that I can use it with MetaMask. Too bad for Trezor company. Their must be a reason on why the MM team doesn't do a lot to mitigate things or is relunctant to fix this issue. So, I'm not totally blaming MM team.

However, I'll make sure to check MetaMask competitor, such as XDEFI wallet, so that I can still use my Trezor devices.

Disappointed that MM team does nothing to address the issue, but I'd understand them if they had issues communicating with Trezor team. Trezor company seems to be one of the very best in terms of tech skills, but when it comes to communication, they're not good at all.

danny-molamola commented 2 years ago

Got the exact same issue. I've got a Trezor One and Trezor T, both got this issue intermittently. Often times I have to unplug and replug or close all the browsers and start again. Tried a couple of Macbook and tried Chrome and Brave, both are the same.

camus1612 commented 2 years ago

It's happened to me also. Can't find a solution. I have Trezor one with chrome. It's sad to see that this problem is so common and stoshilabs don't come up with any solution.

bosomt commented 2 years ago

QA OK

MetaMask developers solved this issue in latest 1.8.0 version tested 10+ times and it works now flawlessly

bosomt commented 2 years ago

@ChooChooCC please confirm and close issue