metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

[Bug]: BRAVE browser - Cannot assign to read only property 'chainId' of object

Open fabianorodrigo opened this issue 2 years ago • 20 comments

Describe the bug

I first detected this behavior on my Angular app, but I've noticed that it happens in other sites, like:

  • https://rinkeby.etherscan.io/.
  • https://ethernaut.openzeppelin.com/
  • https://faucets.chain.link/

When I just get in one of these websites, a error log is shown at console:

inpage.js:1 Uncaught (in promise) TypeError: Cannot assign to read only property 'chainId' of object '#<l>'
    at l._handleChainChanged (inpage.js:1:39117)
    at l._handleChainChanged (inpage.js:1:46662)
    at l._handleChainChanged (inpage.js:1:44260)
    at l._initializeState (inpage.js:1:37927)
    at l._initializeStateAsync (inpage.js:1:46258)

In case of ethernaut.openzeppelin.com and fauctes.chain.link, this one is also shown:

Uncaught (in promise) TypeError: Cannot assign to read only property 'selectedAddress' of object '#<l>'
    at l._handleAccountsChanged (inpage.js:1:39788)
    at r (inpage.js:1:38276)
    at o._handle (inpage.js:17:2422)

I disabled all extensions in my Brave browser

Steps to reproduce

  1. Just access https://faucets.chain.link/ with Brave browser
  2. Show console and the error message is there

Error messages or log output

inpage.js:1 Uncaught (in promise) TypeError: Cannot assign to read only property 'chainId' of object '#<l>'
    at l._handleChainChanged (inpage.js:1:39117)
    at l._handleChainChanged (inpage.js:1:46662)
    at l._handleChainChanged (inpage.js:1:44260)
    at l._initializeState (inpage.js:1:37927)
    at l._initializeStateAsync (inpage.js:1:46258)

Uncaught (in promise) TypeError: Cannot assign to read only property 'selectedAddress' of object '#<l>'
    at l._handleAccountsChanged (inpage.js:1:39788)
    at r (inpage.js:1:38276)
    at o._handle (inpage.js:17:2422)

Uncaught TypeError: Cannot assign to read only property 'chainId' of object '#<l>'
    at l._handleChainChanged (inpage.js:1:39117)
    at l._handleChainChanged (inpage.js:1:46662)
    at l._handleChainChanged (inpage.js:1:44260)
    at s.<anonymous> (inpage.js:1:45866)
    at i (inpage.js:1:56067)
    at s.emit (inpage.js:1:56607)
    at inpage.js:1:55131
    at d.write [as _write] (inpage.js:1:55154)
    at w (inpage.js:17:29867)
    at inpage.js:17:33045

Version

10.18.0

Build type

No response

Browser

Brave

Operating system

Linux

Hardware wallet

No response

Additional context

Brave version: 1.42.86 Chromium: 104.0.5112.81 I have other extensions installed on Brave but all of them are disabled but Metamask

I've done the same access with the same computer using Firefox 103.0.1 (Metamask plugin 10.18.1) and the error message is not shown at console.

fabianorodrigo avatar Aug 04 '22 12:08 fabianorodrigo

Also seeing this error message on Brave, more specifically both chainId errors.

On my end this is the case on all sites (including GitHub right now). Updated the extension and no dice. I also have no other extensions installed.

From basic use it does not seem to impact the extension's usage, but it is quite... annoying.

For context, I am on Windows, same brave version as above.

Ncookiez avatar Aug 04 '22 13:08 Ncookiez

Same problem here! On Brave and Windows as well.

andborges avatar Aug 04 '22 14:08 andborges

In retrospect, this is most likely a Brave issue, not a MetaMask issue - setting the default wallet to None on brave://settings/wallet seems to avoid the error.

image

Ncookiez avatar Aug 04 '22 14:08 Ncookiez

I would also like to add that because of this type error you can't open google docs with metamask installed. Nontheless, the coment above solves the issue.

0xAndoroid avatar Aug 04 '22 19:08 0xAndoroid

I would also like to add that because of this type error you can't open google docs with metamask installed. Nontheless, the coment above solves the issue.

Wow! I had a problem earlier opening a google spreadsheet but I did't link the facts. I've followed the @Ncookiez suggestion and it worked. Thanks!

fabianorodrigo avatar Aug 04 '22 19:08 fabianorodrigo

I would also like to add that because of this type error you can't open google docs with metamask installed. Nontheless, the coment above solves the issue.

Same problem here, I couldn't open a google doc earlier, but I hadn't related it to Brave. Also Storybook and Next.js was showing me this error on every render. Thank you @Ncookiez , your suggestion works for me 💯

Railly avatar Aug 05 '22 00:08 Railly

@Ncookiez You are a genius! I was just getting stuck with it showing up while developing a Next.js app. It works now. Thanks!

kjmczk avatar Aug 05 '22 04:08 kjmczk

I also confirm this error. For now using @Ncookiez suggestion.

sanjaybip avatar Aug 05 '22 06:08 sanjaybip

Yaa had the same error but followed @Ncookiez suggestion and it worked. Thanks @Ncookiez

Mystical94 avatar Aug 05 '22 08:08 Mystical94

Thank you so much @Ncookiez, I had been banging my head to the wall for a whole day before this!

thiagobrez avatar Aug 05 '22 08:08 thiagobrez

I'm facing the same issue, setting the default wallet on Brave is solved as well (thank you so much @Ncookiez). I'm curious if it's just a Brave issue or maybe related to the wallet integration. It's happening for me using wagmi with metamask connector (https://wagmi.sh/docs/connectors/metaMask), curious about if it's happening for all JS connectors.

davigp avatar Aug 05 '22 11:08 davigp

Hey all, this is a Brave issue, they have a pending PR to fix here: https://github.com/brave/brave-core/pull/14483

SamusElderg avatar Aug 05 '22 13:08 SamusElderg

@Ncookiez Thank you!!! You saved me so much time :)

piesrtasty avatar Aug 05 '22 19:08 piesrtasty

In retrospect, this is most likely a Brave issue, not a MetaMask issue - setting the default wallet to None on brave://settings/wallet seems to avoid the error.

image

Wow and this is why I reinstalled my browser & went to all this trouble trying to debug the issue on my nextjs app 🤦🏻 & imported metamask wallets multiple times.... Nevertheless thanks mate.

Suvraneel avatar Aug 06 '22 16:08 Suvraneel

FWIW - I am not sure if it is related, but I had this same issue sowing up after enabling Media Router to cast from the browser. Again, I am not sure if it is related, but I figured I should share.

juanfer78 avatar Aug 07 '22 10:08 juanfer78

Thanks for the fix @Ncookiez! Also, not sure if related or not, but could not use metamask with remix today, had to use another browser at some point.

Pedrojok01 avatar Aug 08 '22 08:08 Pedrojok01

Facing the same issue still.

sagarparker avatar Aug 08 '22 10:08 sagarparker

Facing the same issue still.

try to update Brave browser

mqklin avatar Aug 08 '22 12:08 mqklin

I've had pending updates for the brave browser, after update, everything seems like before!

owieth avatar Aug 09 '22 12:08 owieth

Issue still occurs for me. Was building a next.js app with typescript. Works fine in Chrome.

Brave version: Version 1.42.86 Chromium: 104.0.5112.81 (Official Build) (64-bit)

Screenshot from 2022-08-10 13-32-49

Tried updating brave. Not sure why this happened all of a sudden.

sanjayrjs16 avatar Aug 10 '22 08:08 sanjayrjs16

Looks like Brave merged a fix for this 5 days ago. Not sure when it'll be released though. It's best to follow up directly on their repo: https://github.com/brave/brave-core/pull/14483

kevinghim avatar Aug 10 '22 23:08 kevinghim

fabianorodrigo

i had to use multiple browsers for different purpose and it really sucks

Jayprecode avatar Aug 11 '22 08:08 Jayprecode

brave/brave-core#14483

This error seems to be gone with release v1.42.97 (Aug 17th, 2022)

Maxximus007 avatar Aug 18 '22 08:08 Maxximus007

brave/brave-core#14483

This error seems to be gone with release v1.42.97 (Aug 17th, 2022)

Closing the issue as it was reported the fix has been released by Brave. Thank you all for following up on this!

bschorchit avatar Aug 18 '22 16:08 bschorchit