question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Events don't work

See original GitHub issue

I 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. Screenshot from 2020-02-06 19-01-25 Screenshot from 2020-02-06 17-46-03 Screenshot from 2020-02-06 17-46-14

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nugaoncommented, Feb 28, 2020

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.

1reaction
rekmarkscommented, Feb 8, 2020

Hi @nugaon, thank you for opening an issue. We’re looking into this and will get back to you this week.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found