Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding the Multi-device BETA. (CLICK HERE) #758

Closed
PurpShell opened this issue Jul 14, 2021 · 104 comments
Closed

Regarding the Multi-device BETA. (CLICK HERE) #758

PurpShell opened this issue Jul 14, 2021 · 104 comments
Labels
enhancement New feature or request whatsapp change A change has occurred in WhatsApp Web that breaks functionality

Comments

@PurpShell
Copy link
Collaborator

PurpShell commented Jul 14, 2021

I opened this issue to discuss the multi-device beta that just got announced and available to everyone at the latest version of the WhatsApp and WhatsApp Business beta.

We are in the final stages of supporting this beta update, and we need your help. Visit #889 to help test.

ps: pinned because of so many issues

@PurpShell PurpShell added enhancement New feature or request whatsapp change A change has occurred in WhatsApp Web that breaks functionality labels Jul 14, 2021
@PurpShell
Copy link
Collaborator Author

PurpShell commented Jul 14, 2021

localStorage

{
  "history-sync-earliest-date": "1618517463",
  "md-opted-in": "true",
  "WARoutingInfo": "{\"domain\":\"fb\",\"edgeRouting\":\"CA0IBQ==\"}",
  "f86SIKHSKlIRpTDW+hsAiQ==": "{\"id\":\"global_mute\",\"expiration\":0}",
  "4P/5geRSELQs6BOP78jHJA==": "{\"DELETE_MSG_CLEAR_MEDIA\":true,\"MD_PAYMENT\":true,\"ARCHIVE_BROADCAST\":true,\"RECENT_EMOJI_SYNC\":true,\"VOIP_VOICE_CALL\":true,\"DESKTOP_VOIP_VOICE_CALL\":true,\"DESKTOP_VOIP_VIDEO_CALL\":true,\"MD_BACKEND\":true,\"MD_ADV\":true,\"MD_VOIP_GROUP\":false,\"VOIP_INDIVIDUAL_OUTGOING\":true,\"GROUPS_V_3\":true,\"GROUPS_V_3_CREATE\":false,\"CHANGE_NUMBER_V_2\":true,\"QUERY_STATUS_V_3_THUMBNAIL\":false,\"LIVE_LOCATIONS\":true,\"QUERY_VNAME\":true,\"VOIP_INDIVIDUAL_INCOMING\":true,\"PAYMENTS\":true,\"STICKER_PACK_QUERY\":true,\"LIVE_LOCATIONS_FINAL\":true,\"MEDIA_UPLOAD\":true,\"VNAME_V_2\":true,\"VIDEO_PLAYBACK_URL\":true,\"STATUS_RANKING\":true,\"VOIP_INDIVIDUAL_VIDEO\":false,\"THIRD_PARTY_STICKERS\":true,\"FREQUENTLY_FORWARDED_SETTING\":true,\"GROUPS_V_4_JOIN_PERMISSION\":true,\"RECENT_STICKERS\":false,\"CATALOG\":true,\"STARRED_STICKERS\":false,\"TEMPLATE_MESSAGE\":true,\"TEMPLATE_MESSAGE_INTERACTIVITY\":false,\"EPHEMERAL_MESSAGES\":true,\"RECENT_STICKERS_V_2\":true,\"USER_NOTICE\":true,\"SUPPORT\":true,\"GROUP_UII_CLEANUP\":true}",
  "DmSuwvU7JZflIEQn2wbPRg==": "\"{\\\"9618xxxx95-1624479435@g.us\\\":\\\"1:QENIbvzu\\\",\\\"x96xxxxxxx8-162xxxxxx6@g.us\\\":\\\"1:yeFyj1P5\\\"}\"",
  "Ha6V0naB+Asaj7QK9E9Yhw==": "false",
  "jytAU/x5IFaodumGFgGCqQ==": "false",
  "remember-me": "true",
  "WaInitialHistorySynced": "\"true\"",
  "Q9l1pa9U6RusJLJ/OGoVmw==": "{\"readReceipts\":\"all\",\"groupAdd\":\"all\",\"profilePicture\":\"all\",\"about\":\"all\",\"lastSeen\":\"all\"}",
  "dX8DofUHWjwPKlwiKhrvbg==": "false",
  "MdUpgradeWamFlag": "false",
  "WebEncKeySalt": "\"akzrRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxUkv9Q=\"",
  "last-wid-md": "\"xxxxxxxx2x8:2@c.us\"",
  "WALogPreemptiveCleanUp": "false",
  "DcsZisUDFOGXo22KiEczVw==": "true",
  "WAHistorySyncStatus": "{\"initialCompleted\":true,\"recentCompleted\":true}",
  "MdHistoryLastChunkProcessed": "\"3_1\"",
  "syncd_disabled_due_to_fatal": "false",
  "WANoiseInfoIv": "[\"exxfxxxxxxxYDxxxxQ==\",\"mxxTx7Kxxxxxx3x5xxxA==\",\"exxxxxx/+36Fxxxxxg==\"]",
  "critical_data_synced": "true",
  "nSsarI/MAjXIC+UZpEdYEQ==": "[0,17]",
  "7qZ3zUZ0x8WTp6gYa0npDg==": "\"{}\"",
  "WANoiseInfo": "{\"recoveryToken\":\"B82GoA6DzVxxxxxxRJtzYk5gM=\",\"pubKey\":\"6umXxxxxxxxxxxxxxxINxDxxRkxxxxxxxxTvsxb\",\"privKey\":\"ZLxxxxxxLxxFZynAxxxxxxxxxxPvEpqExxxxxmK\"}",
  "pBzk5ZV/gj4KEC8gIJo2WA==": "\"SJKJLDKSJLD\"",
  "lFi24bP/zxekbO3AVtNXXA==": "[]",
  "abprops": "{\"hash\":\"1Xv5L1\",\"lastSyncTime\":1626293473539}",
  "debugCursor": "1196",
  "WALangPref": "\"en\"",
  "dpKjR53BUeu6nmFjKBsnaQ==": "{\"FavC7xOxxxxxxQ==\":1}",
  "contact-sync-refresh-seconds": "527917",
  "WAShouldCheckContactSyncStatus": "true",
  "mobile-platform": "\"android\"",
  "whatsapp-mutex": "\"x813505889:init_1626295122038\"",
  "WABrowserId": "\"RYc8V8xxxxxxxxx7WwuEg==\""
}

@PurpShell
Copy link
Collaborator Author

Seems the main hurdle is the selector we wait for:

Before:
image

After:
image

@PurpShell

This comment has been minimized.

@PurpShell
Copy link
Collaborator Author

SUCCESS!

@PurpShell
Copy link
Collaborator Author

image

@PurpShell
Copy link
Collaborator Author

hmm, this was about Store and mR

the only hurdle i can see is the session

@PurpShell
Copy link
Collaborator Author

using session is proving pretty hard, seems they are using the IndexedDB;

before:
image

after:
image

@PurpShell
Copy link
Collaborator Author

image
able to import the database, now trying to set it.

@PurpShell
Copy link
Collaborator Author

PurpShell commented Jul 15, 2021

Hey! I would like to know how you guys would like me to handle this. I am going to open a Pull request to just get the bare minimum out there, regarding sessions, i have a few puzzling questions to ask, hopefully you guys can answer!

  • Would it be better if the library had control over where it places it's session and database files? As an example:
    you specify: something like infoPath: "./wweb-info/"in the ClientOptions and the library would go: ./wweb-info/ID/indexedDB/signal-storage.json. (YES/no), provide your way of solving this if you find it an issue!
  • How do you guys close your node app? (CTRL+C, restart via nodemon etc.) and would you rather have a (timed interval between saves (ClientOption; saveIntervalMs: 20000), save on detect of closing the app, or both just in case)

@PurpShell
Copy link
Collaborator Author

#761 has been opened. I'll add my experimental systems there.

@Darker935
Copy link
Contributor

Hey! I would like to know how you guys would like me to handle this. I am going to open a Pull request to just get the bare minimum out there, regarding sessions, i have a few puzzling questions to ask, hopefully you guys can answer!

  • Would it be better if the library had control over where it places it's session and database files? As an example:
    you specify: something like infoPath: "./wweb-info/"in the ClientOptions and the library would go: ./wweb-info/ID/indexedDB/signal-storage.json. (YES/no), provide your way of solving this if you find it an issue!
  • How do you guys close your node app? (CTRL+C, restart via nodemon etc.) and would you rather have a (timed interval between saves (ClientOption; saveIntervalMs: 20), save on detect of closing the app, or both just in case)

Have a default path, controlled by lib, but we can change the path

I close with CTRL + C, or pm2 delete process_pid

@PurpShell
Copy link
Collaborator Author

Hey! I would like to know how you guys would like me to handle this. I am going to open a Pull request to just get the bare minimum out there, regarding sessions, i have a few puzzling questions to ask, hopefully you guys can answer!

  • Would it be better if the library had control over where it places it's session and database files? As an example:
    you specify: something like infoPath: "./wweb-info/"in the ClientOptions and the library would go: ./wweb-info/ID/indexedDB/signal-storage.json. (YES/no), provide your way of solving this if you find it an issue!
  • How do you guys close your node app? (CTRL+C, restart via nodemon etc.) and would you rather have a (timed interval between saves (ClientOption; saveIntervalMs: 20), save on detect of closing the app, or both just in case)

Have a default path, controlled by lib, but we can change the path

I close with CTRL + C, or pm2 delete process_pid

the path is based on operating system? I think that path should be placed by the user

@PurpShell
Copy link
Collaborator Author

Hey! I would like to know how you guys would like me to handle this. I am going to open a Pull request to just get the bare minimum out there, regarding sessions, i have a few puzzling questions to ask, hopefully you guys can answer!

  • Would it be better if the library had control over where it places it's session and database files? As an example:
    you specify: something like infoPath: "./wweb-info/"in the ClientOptions and the library would go: ./wweb-info/ID/indexedDB/signal-storage.json. (YES/no), provide your way of solving this if you find it an issue!
  • How do you guys close your node app? (CTRL+C, restart via nodemon etc.) and would you rather have a (timed interval between saves (ClientOption; saveIntervalMs: 20000), save on detect of closing the app, or both just in case)

@pedroslopez I would like your thoughts!

@PurpShell
Copy link
Collaborator Author

I know for a fact some people store data in databases, so I don't know how i'll support it for them.. Maybe a "exportAll.json" where the structure would be like this:

{
  localStorage: {},
  indexedDB: {}
} 

@pedroslopez
Copy link
Owner

pedroslopez commented Jul 15, 2021

Super interesting! Thanks for looking into this.

From what I'm understanding, WhatsApp Web when in multi-device mode no longer stores any information in localStorage and instead stores everything (including session information) in IndexedDB, so our current solution of injecting the session into localStorage before loading WhatsApp Web no longer works, is that correct?

Puppeteer has a built-in way of persisting these things by specifying a userDataDir path, which includes persisting IndexedDB as well as localStorage. However, I'd like to avoid requiring the use of the local filesystem since people might be running things in a container, which doesn't have a persistent filesystem at least by default. To this point, the session.json that we're writing today as part of examples is just one way of doing it, and people are free to load the session keys from a database or wherever else they need. I would like to keep this functionality if possible.

I think a potential path forward is to see what are the minimal values we need to persist to be able to start up a whatsapp session. This probably contains no past message data, but only things required for authentication. Then, we could do something similar to what we do for localStorage and have a pre-step that writes these things to IndexedDB instead as needed.

@PurpShell
Copy link
Collaborator Author

PurpShell commented Jul 15, 2021

Super interesting! Thanks for looking into this.

From what I'm understanding, WhatsApp Web when in multi-device mode no longer stores any information in localStorage and instead stores everything (including session information) in IndexedDB, so our current solution of injecting the session into localStorage before loading WhatsApp Web no longer works, is that correct?

Puppeteer has a built-in way of persisting these things by specifying a userDataDir path, which includes persisting IndexedDB as well as localStorage. However, I'd like to avoid requiring the use of the local filesystem since people might be running things in a container, which doesn't have a persistent filesystem at least by default. To this point, the session.json that we're writing today as part of examples is just one way of doing it, and people are free to load the session keys from a database or wherever else they need. I would like to keep this functionality if possible.

I think a potential path forward is to see what are the minimal values we need to persist to be able to start up a whatsapp session. This probably contains no past message data, but only things required for authentication. Then, we could do something similar to what we do for localStorage and have a pre-step that writes these things to IndexedDB instead as needed.

  1. yes, it results in a no internet error, and some metadata in localStorage is required like keys, etc..

  2. i searched yesterday, and I found userDataDir. Though it seemed it'll contain too much junk, and it is unprepared for multiple instances, and as you said, people with containers and restarting servers that reset the file-system to it's original state.

  3. I found the minimal values of localStorage, i'll see what happens if i remove the database of chats, contacts, messages

@olirock
Copy link
Contributor

olirock commented Jul 21, 2021

any update? :/

@PurpShell PurpShell linked a pull request Jul 23, 2021 that will close this issue
5 tasks
@PurpShell
Copy link
Collaborator Author

Super interesting! Thanks for looking into this.
From what I'm understanding, WhatsApp Web when in multi-device mode no longer stores any information in localStorage and instead stores everything (including session information) in IndexedDB, so our current solution of injecting the session into localStorage before loading WhatsApp Web no longer works, is that correct?
Puppeteer has a built-in way of persisting these things by specifying a userDataDir path, which includes persisting IndexedDB as well as localStorage. However, I'd like to avoid requiring the use of the local filesystem since people might be running things in a container, which doesn't have a persistent filesystem at least by default. To this point, the session.json that we're writing today as part of examples is just one way of doing it, and people are free to load the session keys from a database or wherever else they need. I would like to keep this functionality if possible.
I think a potential path forward is to see what are the minimal values we need to persist to be able to start up a whatsapp session. This probably contains no past message data, but only things required for authentication. Then, we could do something similar to what we do for localStorage and have a pre-step that writes these things to IndexedDB instead as needed.

  1. yes, it results in a no internet error, and some metadata in localStorage is required like keys, etc..
  2. i searched yesterday, and I found userDataDir. Though it seemed it'll contain too much junk, and it is unprepared for multiple instances, and as you said, people with containers and restarting servers that reset the file-system to it's original state.
  3. I found the minimal values of localStorage, i'll see what happens if i remove the database of chats, contacts, messages

I'm implementing a file management system, debating on userDataDir since it also saves data of other open tabs in the browser aswell. I am going for an Observer with a custom system to save the indexedDB now.

I'm also going to push that to #761, so stay tuned for later today as i'll talk about it on the WWebJS discord.

@thewh1teagle
Copy link

@PurpShell
Hi
to store credentials all you need to do is to backup & restore signal-storage, wawc, wawc_db_enc databases inside indexeddb + localStorage (that's not a lot of data)
now, the challenge after you restore the session is to re-trigger re-sync of chats, messages, etc... has happen once when you log in.
otherwise when you restore the session you will not get your chat history.

@PurpShell PurpShell mentioned this issue Aug 13, 2021
@PurpShell
Copy link
Collaborator Author

@PurpShell
Hi
to store credentials all you need to do is to backup & restore signal-storage, wawc, wawc_db_enc databases inside indexeddb + localStorage (that's not a lot of data)
now, the challenge after you restore the session is to re-trigger re-sync of chats, messages, etc... has happen once when you log in.
otherwise when you restore the session you will not get your chat history.

Hey! I've already documented what you said above. I am working on & testing a file management system solution. I have worked out some stuff that can potentially trigger a re-sync, looks promising.

@PurpShell
Copy link
Collaborator Author

PurpShell commented Aug 13, 2021

After a bunch of days of inactivity, whatsapp re-syncs with the phone. This is shown in a "Downloading Messages X%" message on the splash screen. So far, I've found webpack methods that can re-trigger synchronization.

@IKallS
Copy link

IKallS commented Dec 23, 2021

Hi! Does anybody successfully restore session in Beta?

yes I did, I just create a session by requiring the json file for a saved session and then create a new client with this session data https://guide.wwebjs.dev/features/resuming-sessions

It didn't work for me. The script creates the session but does not remain after restart

`const fs = require('fs');
const axios = require('axios');
const { Client, Location } = require('./index');
const SESSION_FILE_PATH = './session.json';
let sessionCfg;

if (fs.existsSync(SESSION_FILE_PATH)) {
sessionCfg = require(SESSION_FILE_PATH);
}

const client = new Client({
puppeteer: {
headless: false,
// executablePath: "node_modules/puppeteer/.local-chromium/win64-901912/chrome-win/chrome", // chromium default path
executablePath: "/Program Files/Google/Chrome/Application/chrome",
}, session: sessionCfg
});

client.on('authenticated', (session) => {
console.log('AUTHENTICATED', session);
sessionCfg=session;
fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) {
if (err) {
console.error(err);
}
});
});`

@mahmouds12
Copy link

mahmouds12 commented Jan 4, 2022

Hi! Does anybody successfully restore session in Beta?

yes I did, I just create a session by requiring the json file for a saved session and then create a new client with this session data https://guide.wwebjs.dev/features/resuming-sessions

It didn't work for me. The script creates the session but does not remain after restart

`const fs = require('fs'); const axios = require('axios'); const { Client, Location } = require('./index'); const SESSION_FILE_PATH = './session.json'; let sessionCfg;

if (fs.existsSync(SESSION_FILE_PATH)) { sessionCfg = require(SESSION_FILE_PATH); }

const client = new Client({ puppeteer: { headless: false, // executablePath: "node_modules/puppeteer/.local-chromium/win64-901912/chrome-win/chrome", // chromium default path executablePath: "/Program Files/Google/Chrome/Application/chrome", }, session: sessionCfg });

client.on('authenticated', (session) => { console.log('AUTHENTICATED', session); sessionCfg=session; fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) { if (err) { console.error(err); } }); });`

It used to work in Oct-Nov, but now when I tried again it doesn't seem to work.
In previous versions of whatsapp-web.js MD Beta, it used to automatically store a file called "wweb.json" inside folder "/WWebJS/session-{sessionName}/wweb.json", I used to restore session using this json file, but now this wweb.json is not created and I can't even create it manually as it's always undefined in MD.

@mahmouds12
Copy link

mahmouds12 commented Jan 4, 2022

Hi! Does anybody successfully restore session in Beta?

yes I did, I just create a session by requiring the json file for a saved session and then create a new client with this session data https://guide.wwebjs.dev/features/resuming-sessions

It didn't work for me. The script creates the session but does not remain after restart
const fs = require('fs'); const axios = require('axios'); const { Client, Location } = require('./index'); const SESSION_FILE_PATH = './session.json'; let sessionCfg; if (fs.existsSync(SESSION_FILE_PATH)) { sessionCfg = require(SESSION_FILE_PATH); } const client = new Client({ puppeteer: { headless: false, // executablePath: "node_modules/puppeteer/.local-chromium/win64-901912/chrome-win/chrome", // chromium default path executablePath: "/Program Files/Google/Chrome/Application/chrome", }, session: sessionCfg }); client.on('authenticated', (session) => { console.log('AUTHENTICATED', session); sessionCfg=session; fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) { if (err) { console.error(err); } }); });

It used to work in Oct-Nov, but now when I tried again it doesn't seem to work. In previous versions of whatsapp-web.js MD Beta, it used to automatically store a file called "wweb.json" inside folder "/WWebJS/session-{sessionName}/wweb.json", I used to restore session using this json file, but now this wweb.json is not created and I can't even create it manually as it's always undefined in MD.

Actually it works with me in a different approach now... I read the directories inside WWebJS folder and loop through each subfolder (each subfolder is a session folder) and then create a new client with clientId same as the folder name without the word "session-", and it restores the session automatically
here's the code:

const { readdirSync }=require('fs')

const getDirectories=(source) => {

    return readdirSync(source, { withFileTypes: true })
        .filter(dirent => dirent.isDirectory())
        .map(dirent => dirent.name)
}
const currentDir=__dirname + '\\WWebJS\\';
const dirArray=getDirectories(currentDir);

dirArray.forEach(async (element) => {
    if (element==="session") return;
    const sessionName=element.replace("session-", "");
    try {
        global.client[sessionName]=new Client({
            puppeteer: {
                headless: true,
                args: ['--no-sandbox']
            },
            clientId: sessionName,
        });
    } catch (error) {
        console.log(sessionName + ' error while initiating New Client!');
    }

    global.client[sessionName].on('ready', () => {
        console.log(sessionName + ' Client is ready!');
    });
    global.client[sessionName].initialize();

});

@zaidanprtm
Copy link

zaidanprtm commented Jan 7, 2022

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'serialize')
at __puppeteer_evaluation_script__:12:24
at ExecutionContext._evaluateInternal (/project/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async ExecutionContext.evaluate (/project/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.sendMessage (/project/whatsapp/node_modules/whatsapp-web.js/src/Client.js:572:28)
at async Client.<anonymous> (/project/whatsapp/whatsapp-multidevice.js:193:5)

Hi, I got this error after i rescanning qr and try to send a reply message. Any idea how to solve it? Thanks a lot

@zaidanprtm
Copy link

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'serialize')
at __puppeteer_evaluation_script__:12:24
at ExecutionContext._evaluateInternal (/project/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async ExecutionContext.evaluate (/project/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.sendMessage (/project/whatsapp/node_modules/whatsapp-web.js/src/Client.js:572:28)
at async Client.<anonymous> (/project/whatsapp/whatsapp-multidevice.js:193:5)

Hi, I got this error after i rescanning qr and try to send a reply message. Any idea how to solve it? Thanks a lot

UPDATE: fixed by reinstalling using npm i github:pedroslopez/whatsapp-web.js#multidevice

@krishzuz
Copy link

krishzuz commented Jan 8, 2022

Is there any way to track the initialization process like after scanning the QR code it takes some time to download the data right can we track that timing (eg: loading)

@excalibur1010
Copy link

`D:\wabot3\node_modules\whatsapp-web.js\src\Client.js:452
async destroy() {
^^^^^^^

SyntaxError: Unexpected identifier
←[90m at Object.compileFunction (node:vm:352:18)←[39m
←[90m at wrapSafe (node:internal/modules/cjs/loader:1031:15)←[39m
←[90m at Module._compile (node:internal/modules/cjs/loader:1065:27)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m
at Object. (D:\wabot3\node_modules\←[4mwhatsapp-web.js←[24m\index.js:6:13)
←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
`

Hi, I got this error after update

@sistemas-y-redes
Copy link

`D:\wabot3\node_modules\whatsapp-web.js\src\Client.js:452 async destroy() { ^^^^^^^

SyntaxError: Unexpected identifier ←[90m at Object.compileFunction (node:vm:352:18)←[39m ←[90m at wrapSafe (node:internal/modules/cjs/loader:1031:15)←[39m ←[90m at Module._compile (node:internal/modules/cjs/loader:1065:27)←[39m ←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m ←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m ←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m ←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m at Object. (D:\wabot3\node_modules\←[4mwhatsapp-web.js←[24m\index.js:6:13) ←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m `

Hi, I got this error after update

I am getting this same error, other files are also giving syntax errors

@sistemas-y-redes
Copy link

D:\wabot3\node_modules\whatsapp-web.js\src\Client.js:452 async destroy() { ^^^^^^^ SyntaxError: Unexpected identifier ←[90m at Object.compileFunction (node:vm:352:18)←[39m ←[90m at wrapSafe (node:internal/modules/cjs/loader:1031:15)←[39m ←[90m at Module._compile (node:internal/modules/cjs/loader:1065:27)←[39m ←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m ←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m ←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m ←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m at Object. (D:\wabot3\node_modules\←[4mwhatsapp-web.js←[24m\index.js:6:13) ←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
Hi, I got this error after update

I am getting this same error, other files are also giving syntax errors

This happens with the latest version, I have had another bot running in an older version and this morning it errors with this message:

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'Sticker')
at puppeteer_evaluation_script:32:70

@sistemas-y-redes
Copy link

I have switched to node version 17.2.0 and now it works.
Please make it compatible with 12.4.0

@casaservice
Copy link

I have switched to node version 17.2.0 and now it works. Please make it compatible with 12.4.0

hello sistemas-y-redes you still using the same packages whatsapp-web.js or the new one : npm i github:pedroslopez/whatsapp-web.js#multidevice

please answer i have the same probleme

@sistemas-y-redes
Copy link

I have switched to node version 17.2.0 and now it works. Please make it compatible with 12.4.0

hello sistemas-y-redes you still using the same packages whatsapp-web.js or the new one : npm i github:pedroslopez/whatsapp-web.js#multidevice

please answer i have the same probleme

I am using the multidevice branch

@jeremyandes
Copy link
Contributor

Hi everyone!

I'm trying to reply with buttons in multidevice, but the message is never delivered, it's working but only with string messages.

My code is something like this:

let button = new Buttons(
    `Hi! Welcome to initial config of ${NameApp}`,
    [
        { body: '• Button example 1' },
        { body: '• Button example 2' },
        { body: '• Button example 3' },
    ],
    `Hi ${name}!`,
    footer,
);
client.sendMessage(msg.from, button);

And my client is this one:

const client = new Client({
    puppeteer: {
        headless: false,
        args: [
            '--no-sandbox',
        ],
        clientId: 'example',
        disableMessageHistory: true 
    }
});

Any thoughts?

@voxsoftware
Copy link

voxsoftware commented Jan 28, 2022 via email

@jeremyandes
Copy link
Contributor

Thank you @voxsoftware for your quick answer!

@setsmart
Copy link

setsmart commented Feb 20, 2022

hello all,

Install via npm i github:pedroslopez/whatsapp-web.js#multidevice

this is part of this update:

Multi-device branch #889

error message that appears after executing the above command:

code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\set_t\OneDrive\Área de Trabalho\WhatsApp-Buttons\whatsapp-web.js-main\src\Client.js',
'C:\Users\set_t\OneDrive\Área de Trabalho\WhatsApp-Buttons\whatsapp-web.js-main\index.js',
'C:\Users\set_t\OneDrive\Área de Trabalho\WhatsApp-Buttons\whatsapp-web.js-main\example.js'
]
}

@NowDev
Copy link
Contributor

NowDev commented Feb 25, 2022

I've noticed that multidevice isn't a beta feature anymore and i don't even have the option to disable it.

@elhumbertoz
Copy link
Contributor

Error after scan QR.

(node:23136) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'Socket') at __puppeteer_evaluation_script__:6:62 at ExecutionContext._evaluateInternal (C:\Dropbox\CEO.source\mywhatsapp\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async ExecutionContext.evaluate (C:\Dropbox\CEO.source\mywhatsapp\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16) at async Client.initialize (C:\Dropbox\CEO.source\mywhatsapp\node_modules\whatsapp-web.js\src\Client.js:227:9)

@elhumbertoz
Copy link
Contributor

Error after scan QR.

(node:23136) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'Socket') at __puppeteer_evaluation_script__:6:62 at ExecutionContext._evaluateInternal (C:\Dropbox\CEO.source\mywhatsapp\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async ExecutionContext.evaluate (C:\Dropbox\CEO.source\mywhatsapp\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16) at async Client.initialize (C:\Dropbox\CEO.source\mywhatsapp\node_modules\whatsapp-web.js\src\Client.js:227:9)

Resolved in: https://github.com/pedroslopez/whatsapp-web.js/pull/889/files/358bb9d0a83f54d4fccabc8634943d97a9a8318f..25c66acf0def4f0296ebe9c917d6855eaa2f859c

@LittleKing205
Copy link

I've noticed that multidevice isn't a beta feature anymore and i don't even have the option to disable it.

Me too... What I have to Do now?

@pedroslopez
Copy link
Owner

@NowDev @LittleKing205 and everyone else that's now stuck not being able to use main:

If you really really can't wait, you can use the multidevice branch directly by following the instructions on #889
HOWEVER, at this point I would suggest against it because I'm aiming to get multidevice support on main and released this weekend, and there will be a couple changes in the MD branch vs what will end up going on main.

@LittleKing205
Copy link

LittleKing205 commented Feb 26, 2022

I can wait for it. You make a realy great job with this package. I was a little bit irritated today, that my bot gas stopped ther work.

@pedroslopez
Copy link
Owner

Multi-device support is now released as part of v1.16.0. Thanks everyone for testing!

Check out the release notes at https://github.com/pedroslopez/whatsapp-web.js/releases/tag/v1.16.0

@pedroslopez pedroslopez unpinned this issue Mar 2, 2022
@PortalAt12345
Copy link

Dear Pedroslopez, first of all I really really appreciate your effort and hard work. I want to all you about my scenario, I use a Dual App when I trying to connect (QR SCAN) it shows error on terminal 'Multi device can not connected' something like that kindly fix this issue. once again respect for your effort.👏👏👏
Peace

@jeremyandes
Copy link
Contributor

jeremyandes commented Mar 2, 2022

@PortalAt12345 this issue is closed due to multidevice support in main branch.

Btw you can take a look to what auth-strategy is the best for you: https://wwebjs.dev/guide/authentication.html

@PortalAt12345
Copy link

@PortalAt12345 this issue is closed due to multidevice support in main branch.

Btw you can take a look to what auth-strategy is the best for you: https://wwebjs.dev/guide/authentication.html

No, it is for multi-device this solution not meet my scenario. my scenario is different, I used multi accounts (clone apps) with the help of this app I can use more than one WhatsApp account in same phone in simple words, I have 3 different WhatsApp in same phone with different number. It shows an error
Scanning Device Config:

  1. App Name: Multiple Accounts
  2. Phone Name: Xiaomi Note 11
  3. Android Version: 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request whatsapp change A change has occurred in WhatsApp Web that breaks functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.