MetaMask / MetaMask/metamask-extension

[Bug]:

Open
#45,580 1 comment 0 reactions 0 assignees View on GitHub
cs-triaged external-contributor needs-reproduction regression-prod-13.44.0 Sev3-low team-networks type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### Describe the bug

Using a permissioned EVM chain with the auth data embedded in the URI I get the following error after adding a custom token:

[ExtensionStore]: Writing to local store: 3.196044921875 ms
service-worker.js:14079 Error: No provider available for chain 0x347be962
(anonymous) @ service-worker.js:14079
(anonymous) @ service-worker.js:14580
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:13
await in (anonymous)
o @ service-worker.js:14071
setTimeout
(anonymous) @ service-worker.js:14079
(anonymous) @ service-worker.js:14580
(anonymous) @ service-worker.js:14580
_startPolling @ 9417.4c1e668cd49e5278a4f1.js:13
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:13
await in (anonymous)
o @ service-worker.js:14071
setTimeout
(anonymous) @ service-worker.js:14079
(anonymous) @ service-worker.js:14580
(anonymous) @ service-worker.js:14580
_startPolling @ 9417.4c1e668cd49e5278a4f1.js:13
startPolling @ 9417.4c1e668cd49e5278a4f1.js:5
subscribe @ 4594.5ee9c8c66bc7df4783a8.js:1
await in subscribe
eQ @ 4594.5ee9c8c66bc7df4783a8.js:1
eW @ 4594.5ee9c8c66bc7df4783a8.js:1
eG @ 4594.5ee9c8c66bc7df4783a8.js:1
e1 @ 4594.5ee9c8c66bc7df4783a8.js:1
(anonymous) @ 4594.5ee9c8c66bc7df4783a8.js:1
p @ 268.1db177b47b8745c0924f.js:4
_internalPublishDelegated @ 268.1db177b47b8745c0924f.js:4
i @ 268.1db177b47b8745c0924f.js:4
p @ 268.1db177b47b8745c0924f.js:4
_internalPublishDelegated @ 268.1db177b47b8745c0924f.js:4
i @ 268.1db177b47b8745c0924f.js:4
p @ 268.1db177b47b8745c0924f.js:4
publish @ 268.1db177b47b8745c0924f.js:4
update @ 4594.5ee9c8c66bc7df4783a8.js:1
w @ 9417.4c1e668cd49e5278a4f1.js:2
await in w
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:2
p @ 268.1db177b47b8745c0924f.js:4
_internalPublishDelegated @ 268.1db177b47b8745c0924f.js:4
i @ 268.1db177b47b8745c0924f.js:4
p @ 268.1db177b47b8745c0924f.js:4
_internalPublishDelegated @ 268.1db177b47b8745c0924f.js:4
i @ 268.1db177b47b8745c0924f.js:4
p @ 268.1db177b47b8745c0924f.js:4
publish @ 268.1db177b47b8745c0924f.js:4
addNetwork @ 9417.4c1e668cd49e5278a4f1.js:6
_addNetworkAndSetActive @ 9380.52802e4779585ffa36d8.js:2
(anonymous) @ 9380.52802e4779585ffa36d8.js:5
(anonymous) @ 3527.2a70cbf140158d68e54a.js:1
I @ 9417.4c1e668cd49e5278a4f1.js:13
P @ 9417.4c1e668cd49e5278a4f1.js:13
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:13
_write @ 9417.4c1e668cd49e5278a4f1.js:5
R @ 9417.4c1e668cd49e5278a4f1.js:13
A @ 9417.4c1e668cd49e5278a4f1.js:13
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:13
d @ 4514.de21013537d4bca2c536.js:146
(anonymous) @ 3527.2a70cbf140158d68e54a.js:1
J @ 4514.de21013537d4bca2c536.js:146
Y @ 4514.de21013537d4bca2c536.js:146
(anonymous) @ 4514.de21013537d4bca2c536.js:146
(anonymous) @ 4305.3570750c2bee0057c0dc.js:1
service-worker.js:14079 [ExtensionStore]: Writing 1 keys to local store
service-worker.js:14079 [ExtensionStore]: Removing 0 keys from local store
9380.52802e4779585ffa36d8.js:5 [ExtensionStore]: Writing to local store: 5.41796875 ms
service-worker.js:14079 [ExtensionStore]: Writing 1 keys to local store
service-worker.js:14079 [ExtensionStore]: Removing 0 keys from local store
9380.52802e4779585ffa36d8.js:5 [ExtensionStore]: Writing to local store: 10.175048828125 ms
service-worker.js:14079 Failed to get token standard and details. Error: TypeError: Illegal invocation
(anonymous) @ service-worker.js:14079
getTokenStandardAndDetailsByChain @ 9380.52802e4779585ffa36d8.js:2
await in getTokenStandardAndDetailsByChain
(anonymous) @ 9380.52802e4779585ffa36d8.js:5
(anonymous) @ 3527.2a70cbf140158d68e54a.js:1
I @ 9417.4c1e668cd49e5278a4f1.js:13
P @ 9417.4c1e668cd49e5278a4f1.js:13
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:13
_write @ 9417.4c1e668cd49e5278a4f1.js:5
R @ 9417.4c1e668cd49e5278a4f1.js:13
A @ 9417.4c1e668cd49e5278a4f1.js:13
(anonymous) @ 9417.4c1e668cd49e5278a4f1.js:13
d @ 4514.de21013537d4bca2c536.js:146
(anonymous) @ 3527.2a70cbf140158d68e54a.js:1
J @ 4514.de21013537d4bca2c536.js:146
Y @ 4514.de21013537d4bca2c536.js:146
(anonymous) @ 4514.de21013537d4bca2c536.js:146
(anonymous) @ 4305.3570750c2bee0057c0dc.js:1
service-worker.js:14079 [ExtensionStore]: Writing 4 keys to local store
service-worker.js:14079 [ExtensionStore]: Removing 0 keys from local store
9380.52802e4779585ffa36d8.js:5 [ExtensionStore]: Writing to local store: 2.083984375 ms

Note that when adding the network I can validate that the endpoint works because metamask is able to corectly determine when the chain ID is not correct for the network, this only appears to be when making token related RPC.

This seems somewhat simlar to a bug I raised and was fixed last year:

https://github.com/MetaMask/metamask-extension/issues/34241

Wondering if you could help? This was brought to our attention by a client who beelives this worked as recently as June this year if that helps tracking down the regression.

### Expected behavior

Expect metamask to succesfully be able to connect to the RPC endpoint containing embedded auth info

### Screenshots/Recordings

_No response_

### Steps to reproduce

Create a private permissioned block chain, for example using Besu.
Create a new network using the RPC endpoint contaiing the auth details within the endpoint, for example:
https://USERNAME:PASSWORD@rpc-endpoint/
Add a new custom token to this network passing the address of a deployed ERC-20.
Observe the documented error in the developer console.

After some time an error banner will also say "Can not connect to . Edit RPC."

### Error messages or log output

```shell

```

### Where was this bug found?

Live version (from official store)

### Version

13.44.0

### Build type

None

### Browser

Chrome

### Operating system

MacOS

### Hardware wallet

_No response_

### Additional context

_No response_

### Severity

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with a Besu-style permissioned chain whose RPC URL contains embedded credentials, then add a custom ERC-20 token and inspect the token-related RPC errors in service-worker.js. Compare network setup with token polling and verify that the custom token works without the provider or illegal-invocation errors and the connection banner does not appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.