MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.96k stars 4.89k forks source link

[Bug]: Multichain - "Disconnect" menu item from popup Connections page causes error #23790

Closed darkwing closed 6 months ago

darkwing commented 6 months ago

Describe the bug

When using the three-dot menu next to an account in the Connections popup view, then clicking "Disconnect", I get an error that bricks the extension.

Expected behavior

The account should be disconnected without problem.

Screenshots/Recordings

https://github.com/MetaMask/metamask-extension/assets/46655/ea23a651-b9b7-4e54-ba4d-6bec8f8eec34

Steps to reproduce

  1. Go to any dapp
  2. Open the extension, click the Connections favicon
  3. Click "Connect accounts"
  4. Connect Account 1
  5. Click the three-dot menu next to Account 1
  6. Click the "Disconnect" menu item
  7. (See the error)

Error messages or log output

TypeError: Cannot read properties of undefined (reading 'name')
  at Connections (connections.tsx:350:53)
  at renderWithHooks (react-dom.development.js:16260:1)
  at updateFunctionComponent (react-dom.development.js:18347:1)
  at beginWork$1 (react-dom.development.js:20176:1)
  at HTMLUnknownElement.callCallback (react-dom.development.js:336:1)
  at Object.invokeGuardedCallbackDev (react-dom.development.js:385:1)
  at invokeGuardedCallback (react-dom.development.js:440:1)
  at beginWork$$1 (react-dom.development.js:25780:1)
  at performUnitOfWork (react-dom.development.js:24695:1)
  at workLoopSync (react-dom.development.js:24671:1) '\n  at Connections (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-6.js:14880:48)\n  at Route (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:17586:29)\n  at Authenticated (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-8.js:4644:5)\n  at ConnectFunction (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:12688:41)\n  at Switch (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:17792:29)\n  at div\n  at chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/common-6.js:4473:3\n  at div\n  at Routes (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-11.js:1463:5)\n  at ConnectFunction (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:12688:41)\n  at C (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:17847:37)\n  at LegacyI18nProvider (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-7.js:12455:1)\n  at I18nProvider (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-7.js:12438:53)\n  at LegacyMetaMetricsProvider (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-7.js:12633:1)\n  at MetaMetricsProvider (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-7.js:12543:3)\n  at Router (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:17217:30)\n  at HashRouter (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:15839:35)\n  at Provider (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-3.js:12397:20)\n  at Index (chrome-extension://oehplhbehlbgjdapfkoemdgjlgbjpkkg/ui-10.js:7636:5)'

Oddly enough, above it I'm seeing a few more errors that look related:

Warning: Failed prop type: The prop `requestType` is marked as required in `PermissionConnect`, but its value is `undefined`.
    in PermissionConnect (created by ConnectFunction)
    in ConnectFunction (created by Context.Consumer)
    in Route (created by Authenticated)
    in Authenticated (created by ConnectFunction)
    in ConnectFunction (created by Routes)
    in Switch (created by Routes)
    in div (created by ForwardRef)
    in ForwardRef (created by Routes)
    in div (created by Routes)
    in Routes (created by ConnectFunction)
    in ConnectFunction (created by Context.Consumer)
    in withRouter(Connect(Routes)) (created by Index)
    in LegacyI18nProvider (created by Index)
    in I18nProvider (created by Index)
    in LegacyMetaMetricsProvider (created by Index)
    in MetaMetricsProvider (created by Index)
    in Router (created by HashRouter)
    in HashRouter (created by Index)
    in Provider (created by Index)
    in Index
overrideMethod @ backend.js:2045
await in overrideMethod (async)
(anonymous) @ actions.ts:3710
handleResponse @ metaRPCClientFactory.js:99
emit @ events.js:153
addChunk @ _stream_readable.js:291
readableAddChunk @ _stream_readable.js:278
Readable.push @ _stream_readable.js:245
_write @ index.js:68
doWrite @ _stream_writable.js:428
writeOrBuffer @ _stream_writable.js:417
Writable.write @ _stream_writable.js:334
ondata @ readable.js:662
emit @ events.js:153
addChunk @ readable.js:278
readableAddChunk @ readable.js:255
Readable.push @ readable.js:201
_onMessage @ index.js:30
(anonymous) @ index.js:12
Show 16 more frames
Show less
actions.ts:3710 Warning: Failed prop type: The prop `subjectMetadata.name` is marked as required in `PermissionsRedirect`, but its value is `undefined`.
    in PermissionsRedirect (created by PermissionConnect)
    in PermissionConnect (created by ConnectFunction)
    in ConnectFunction (created by Context.Consumer)
    in Route (created by Authenticated)
    in Authenticated (created by ConnectFunction)
    in ConnectFunction (created by Routes)
    in Switch (created by Routes)
    in div (created by ForwardRef)
    in ForwardRef (created by Routes)
    in div (created by Routes)
    in Routes (created by ConnectFunction)
    in ConnectFunction (created by Context.Consumer)
    in withRouter(Connect(Routes)) (created by Index)
    in LegacyI18nProvider (created by Index)
    in I18nProvider (created by Index)
    in LegacyMetaMetricsProvider (created by Index)
    in MetaMetricsProvider (created by Index)
    in Router (created by HashRouter)
    in HashRouter (created by Index)
    in Provider (created by Index)
    in Index
overrideMethod @ backend.js:2045
await in overrideMethod (async)
(anonymous) @ actions.ts:3710
handleResponse @ metaRPCClientFactory.js:99
emit @ events.js:153
addChunk @ _stream_readable.js:291
readableAddChunk @ _stream_readable.js:278
Readable.push @ _stream_readable.js:245
_write @ index.js:68
doWrite @ _stream_writable.js:428
writeOrBuffer @ _stream_writable.js:417
Writable.write @ _stream_writable.js:334
ondata @ readable.js:662
emit @ events.js:153
addChunk @ readable.js:278
readableAddChunk @ readable.js:255
Readable.push @ readable.js:201
_onMessage @ index.js:30
(anonymous) @ index.js:12
Show 16 more frames
Show less
backend.js:16254 WebSocket connection to 'ws://localhost:8097/' failed: 
connectToDevTools @ backend.js:16254
Show 1 more frame
Show less
2backend.js:2045 Error: Actions must be plain objects. Use custom middleware for async actions.
  at Object.performAction (instrument.ts:143:13)
  at liftAction (instrument.ts:376:25)
  at dispatch (instrument.ts:901:26)
  at index.js:27:1
  at redux-toolkit.cjs.development.js:384:1
  at onClick (connections.tsx:391:30)
  at HTMLUnknownElement.callCallback (react-dom.development.js:336:1)
  at Object.invokeGuardedCallbackDev (react-dom.development.js:385:1)
  at invokeGuardedCallback (react-dom.development.js:440:1)
  at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:454:1)


### Version

develop

### Build type

None

### Browser

Chrome

### Operating system

MacOS

### Hardware wallet

_No response_

### Additional context

_No response_

### Severity

_No response_
darkwing commented 6 months ago

After closing the popup, and re-opening it, then opening the Connections favicon again, the account is disconnected.