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.

Store.checkNumberBeta empty on new bootstrap_qr.js file

See original GitHub issue

Description

After running the function injectParasite, the key Store.checkNumberBeta is undefined. However, this happens only when the WhatsApp Web page loads the js file bootstrap_qr.79aba964bea38dbcc501.js

From what I tested, sometimes the page loads the file bootstrap_qr.4ec5f0d2877d5f3b7590.js, and in this case the current conditions of checkNumberBeta in storeObjects works fine.

This happens because in the new js file (hash 79aba9...) the queryExists function was moved from being the single default export of a module, to being one of two functions of a new module containing:

t.queryExists = function (e) ...
t.queryPhoneExists = function (e) ...
Module code in bootstrap_qr.79aba964bea38dbcc501.js
Beautified code of the new module in the js file with hash 79aba9...

Because of this situation, any place that calls WAPI.checkNumberStatus can have problems, like this one on #1519

Environment

  • Venom version(s): 4.0.7 (using WAPI directly)
  • Browser: Chrome 99
  • OS: Ubuntu 21.10
  • Node version: Node 17

Your Code

To fix this, I changed the checkNumberBeta object in the storeObjects to:

{
  id: 'checkNumberBeta',
  conditions: (module) => {
    // function 'queryExists' is on bootstrap_qr.79aba964bea38dbcc501.js
    // function 'default' is on bootstrap_qr.4ec5f0d2877d5f3b7590.js
    const f = module.queryExists || module.default || {};
    return typeof f.toString === 'function' &&
      f.toString().includes('Should not reach queryExists MD')
      ? { queryExists: f }
      : null
  },
},

And changed the call on checkNumberStatus.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
matheusb-compcommented, Mar 9, 2022

I only changed the storeObjects file, and these lines to:

if (await WAPI.isBeta()) {
  return await Store.checkNumberBeta.queryExists(id)
Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript · Bootstrap v5.0
Bring Bootstrap to life with our optional JavaScript plugins. Learn about each plugin, our data and programmatic API options, and more.
Read more >
JavaScript - Bootstrap
js contain all plugins in a single file. Include only one. Plugin dependencies. Some plugins and CSS components depend on other plugins. If...
Read more >
JavaScript - Bootstrap
Bring Bootstrap to life with our optional JavaScript plugins built on jQuery. Learn about each plugin, our data and programmatic API options, and...
Read more >
Validation · Bootstrap v5.0
Provide valuable, actionable feedback to your users with HTML5 form validation, via browser default behaviors or custom styles and JavaScript.
Read more >
Introduction · Bootstrap v5.1
Looking to quickly add Bootstrap to your project? Use jsDelivr, a free open source CDN. Using a package manager or need to download...
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