MetaMask / MetaMask/metamask-extension
[Bug]: MetaMask's permission/connection flow cannot establish the extension communication channel for the Freenet origin
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
I have a web3js website running on Freenet.org (a p2p internet that uses sandbox/iframes to display webpages) that consists of a simple connect wallet and send transaction buttons. The Metamask wallet fails to return accounts and when testing with this command:
`
window.ethereum.request({
method: "eth_requestAccounts"
}).then(
accounts => console.log("CONNECTED:", accounts),
error => console.error("FAILED:", error)
)
`
I receive this error message with promise pending:
`
Uncaught AggregateError: ExtensionPortStream postMessage failed
`
### Expected behavior
Metamask is supposed to return a promise with the accounts thus opening a window of the extension in the browser to select which accounts to connect to the dapp.
### Screenshots/Recordings
### Steps to reproduce
1. download Freenet
2. make sure metamask is installed
3. open browser and visit http://127.0.0.1:7509/v1/contract/web/D2fHNFNEPMSnCr1QmjPq8655zanXzsKa9xJ4fvjGnr3D/
4. open console and run `window.ethereum.request({method: "eth_requestAccounts"}).then(accounts => console.log("CONNECTED:", accounts), error => console.error("FAILED:", error))`
5. see error message
### Error messages or log output
```shell
contentscript.js:14063 Uncaught AggregateError: ExtensionPortStream postMessage failed
MetaMask: Lost connection to "MetaMask RpcProvider".
MetaMask: Disconnected from MetaMask background. Page reload required.
```
### Where was this bug found?
Live version (from official store)
### Version
13.42.0
### Build type
None
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
_No response_
### Severity
_No response_
Contributor guide
Research direction
Start by reproducing the issue at the provided Freenet URL with the documented eth_requestAccounts call, then compare the ExtensionPortStream and MetaMask RpcProvider disconnect logs. Trace the extension communication path involved in the sandboxed Freenet page. Done means the request resolves with accounts and the connection remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100