Events don't work
See original GitHub issueI use the inpage-provider with the “extension-port-stream” package at my extension’s index page. The application with the provider can’t get subscription events (for example at newBlockHeaders, or receive transaction receipts after send).
this.web3.client.eth.subscribe('newBlockHeaders', (error, result) => {
if (error) {
console.error("Error happened at new block", error);
return;
}
})
.on("data", function(blockHeader){
console.log("blockHeader", blockHeader);
});
It shows some errors because of wallet_sendDomainMetadata, unexcepted account change
and also the eventemitter memory leak, but the provider also seems initialized correct way, also I can send transactions, etc.

Init process:
const metamaskPort = chrome.runtime.connect("nkbihfbeogaeaoehlefnkodbefgpgknn");
const pluginStream = new PortStream(metamaskPort);
let provider = new MetamaskInpageProvider(pluginStream);
console.log("provider", provider);
this.web3.client = new Web3(provider);
version: 4.0.4 (npm) web3: 1.2.6 browser: Chrome 80.0.3987.87
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >Javascript events sometimes don't work - Laracasts
In my application I am using javascript video element events like, onplaying, onpause, onstalled etc. The problem is, these elements do not get...
Read more >html function doesn't work with any event - Stack Overflow
You've defined your function but you never call it. Now you need to call it by event or in form load getIPs(); :....
Read more >Events don't work (Linux). :: AdVenture Capitalist General ...
Events don't work (Linux). When I go into the event tab it says "Oops! To access Events, you will need the latest version...
Read more >How to Fix The Events Calendar Shortcode Not Working
The fix · 1. Go to Appearance, then Widgets in the WordPress administration area · 2. Drag a Text widget where you'd like...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @rekmarks, I use 1.2.6 version of web3. I checked recently maybe this would be the problem and as I see in the main repo’s package.json, the Metamask uses ^0.20.7 which is a significant version difference. Is there any plan recently to update its version? At the new version there is no sendAsync function already, only the normal send methods with the EventEmitter returns that I also use in my application. As I see this repo doesn’t support this way to handle send requests only the sendAsync functions yet. If you would like to redesign and update it I would love to help in this, if somehow we could get in touch, because I don’t know the roadmap of the development as you can see at #20 pull request too.
Hi @nugaon, thank you for opening an issue. We’re looking into this and will get back to you this week.