brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.61k stars 2.29k forks source link

Error when entering site requiring Brave Wallet #24413

Open ancho85 opened 2 years ago

ancho85 commented 2 years ago

Description

Before this latest update there was no issue. By opening the site mycryptoheroes.net an error appears on console. This error is not shown if opened in incognito or with "Default cryptocurrency wallet" set to None.

app.307d54b.js:2 Uncaught TypeError: Cannot assign to read only property 'send' of object '#' at Object. (app.307d54b.js:2:5490589) at o (runtime.76fd5d3.js:1:563) at Object. (app.307d54b.js:2:5368737) at o (runtime.76fd5d3.js:1:563) at Object. (app.307d54b.js:2:529137) at o (runtime.76fd5d3.js:1:563) at Object. (app.307d54b.js:2:466040) at o (runtime.76fd5d3.js:1:563) at Object. (app.307d54b.js:2:5362244) at o (runtime.76fd5d3.js:1:563)

That site works ok now on Brave for Android and also tested with Chrome and Metamask. No issues found. Only now with Brave Desktop version 1.42.86 Chromium 104.0.5112.81 64-bit

Steps to Reproduce

  1. Set Default cryptocurrency wallet to "Brave Wallet" (or leave it unchanged as I already have it like this)
  2. Open a new tab. Press F12 to view console errors
  3. Go to mycryptoheroes.net. The error shows without any interaction yet with the wallet.
  4. The error prevents the normal page usage. I cannot click the rectangled text on the right "My Crypto Heroes". This click should request the wallet signature.
  5. OPTIONAL: Clear all site data, repeat steps 1-4. Same result.

Actual result:

No errors should appear. I should be able to click the rectangled text on the right to make dApp request my sign with the wallet.

Expected result:

Page should not throw any error what so ever.

Reproduces how often:

Easily

Brave version (brave://version info)

Brave Desktop version 1.42.86 Chromium 104.0.5112.81 64-bit

Version/Channel Information:

Current version only

Other Additional Information:

with or without shields same thing happens

Miscellaneous Information:

ancho85 commented 2 years ago

Exact same error in a Linux machine after upgrading to 1.42.86 and no extensions enabled.

ancho85 commented 2 years ago

Trying an alternative. Installed Metamask on current Brave version, set setting to prefer extension and even more errors are shown in console. image

wheresthebeefy commented 2 years ago

Getting the same errors when using Metamask in Brave Desktop version 1.42.86 Chromium 104.0.5112.81 64-bit when trying to use networks other than the Ethereum Mainnet, for example Polygon, or a test network, whereas it worked fine in the previous version. Always get variations of "Can't assign to read only property 'chainId' of object '#<1>'

Screenshot of the console at uniswap.org when trying to make a swap on the Goerli test network:

image

When I switch to the Ethereum mainnet, everything seems to work, but I still get a selectedAddress error in the console:

image

wheresthebeefy commented 2 years ago

Also on https://remix.ethereum.org, it won't let you choose 'Injected Provider - Metamask' anymore for any network, even on Mainnet, when you head to the Deploy & Run Transactions menu

Ncookiez commented 2 years ago

Setting the default wallet to None on brave://settings/wallet seems to avoid the errors on my end.

image

Mkkoll commented 2 years ago

This is easily reproducible on app.pooltogether.com The site will load and work well only when Metamask Extension is set to Ethereum Mainnet chainID 1. Having metamask set to any other chain will cause the site to break. Disabling Braves internal Brave Wallet fixes all issues. Seems like some sort of issue with Brave Wallet and Metamask extension fighting for the web3 connection and breaking stuff.

Please fix. Imho this is a high priority bug if it is causing a browser that touts itself at the cutting edge of web3 and some parts dont work.

wheresthebeefy commented 2 years ago

Ncookiez workaround fixed things (setting the default wallet to None on brave://settings/wallet). Thank you Ncookiez!

ancho85 commented 2 years ago

Setting default wallet to None doesn't fix the original problem (without metamask installed). The page won't detect any web3 connection at all and just suggest to download a wallet. I guess that is the expected behavior for that setting.

wheresthebeefy commented 2 years ago

Yes true, still a bug that needs to be fixed

ghost commented 2 years ago

Same issue reported by several Brave users on thalesmarket.io, since last Brave update, MetaMask transactions are not working anymore.

The fix (setting the default wallet to None on brave://settings/wallet) works but pretty hard to reach every users to warn them (as Brave has no specific User-Agent).

westonnelson commented 2 years ago

This is easily reproducible on app.pooltogether.com The site will load and work well only when Metamask Extension is set to Ethereum Mainnet chainID 1. Having metamask set to any other chain will cause the site to break. Disabling Braves internal Brave Wallet fixes all issues. Seems like some sort of issue with Brave Wallet and Metamask extension fighting for the web3 connection and breaking stuff.

Please fix. Imho this is a high priority bug if it is causing a browser that touts itself at the cutting edge of web3 and some parts dont work.

I just wanted to echo this - this is exactly what I experience. Please fix/give this priority attention!

srirambv commented 2 years ago

Can you check if the issue is fixed on 1.42.88? This was released over the weekend

wheresthebeefy commented 2 years ago

Seems to be okay for me when I switch back to enabling the default wallet to Brave Wallet

ancho85 commented 2 years ago

I'm still having the same error as I reported. Setting to Brave Wallet automatically throws this error when entering that page.

app.edf4475.js:2 Uncaught TypeError: Cannot assign to read only property 'send' of object '#' at Object. (app.edf4475.js:2:5491377) at o (runtime.c19fc28.js:1:563) at Object. (app.edf4475.js:2:5369525) at o (runtime.c19fc28.js:1:563) at Object. (app.edf4475.js:2:529137) at o (runtime.c19fc28.js:1:563) at Object. (app.edf4475.js:2:466040) at o (runtime.c19fc28.js:1:563) at Object. (app.edf4475.js:2:5363032) at o (runtime.c19fc28.js:1:563)

ancho85 commented 2 years ago

Issue still present with version 1.42.95 Now appears an extra error before the one already described.

inpage.js:1 Uncaught TypeError: Cannot assign to read only property 'ethereum' of object '#' at s (inpage.js:1:47253) at r.initializeProvider (inpage.js:1:47653) at Object. (inpage.js:1:1062) at Object. (inpage.js:1:1122) at 1.@babel/runtime/helpers/interopRequireDefault (inpage.js:1:1135) at i (inpage.js:1:254) at e (inpage.js:1:414) at inpage.js:1:431 This error does not appear after disabling the metamask extension leaving only Brave Wallet active.

ancho85 commented 2 years ago

Just upgraded to Android version 1.42.94 and now the interaction with the built-in wallet is also broken for this site. Tested with others like opensea and tofuntf with no issues.

enzoferey commented 2 years ago

Still happening on MacOS Brave version 1.42.97.

Kind of related to https://github.com/brave/brave-core/pull/14483. It happens because of trying to set properties on a read only object. In some cases it's the window object, in some cases its the window.web3.currentProvider (which changes depending on your default wallet config in the browser).

ancho85 commented 2 years ago

Issue no longer present with desktop versión 1.43.89 on Windows. Tested also with version 1.43.90 on Android with no visible problems. I will update after testing with Linux. Edit: Tested with Ubuntu, working fine again.

ancho85 commented 1 year ago

Brave crashes when site request message sign. Until today its been about 3 months since this behavior started. I assume it is the same issue since other sites won't crash