Session saving problem
See original GitHub issueDescription
The session is created, but when the script is restarted, the session does not rise and asks to rescanQr
Environment
- Venom version(s): [4.0.5]
- Browser: [default venom]
- OS: [linux ubuntu 20.04]
- Node version: [Node 12.22.5]
Steps to Reproduce
- [Session creation]
- [Reboot script]
Log Output
Session creation
info: [79297401290] Initializing browser wss...
info: [79297401290] Browser successfully opened
info: [79297401290] checking headless...
info: [79297401290] headless option is active, browser hidden
info: [79297401290] Checking page...
info: [79297401290] Page successfully accessed
- [instance: 79297401290]: Waiting page load
- [instance: 79297401290]: Checking is logged...
- [instance: 79297401290]: Waiting for QRCode Scan...
- [instance: 79297401290]: Waiting for QRCode Scan: Attempt 1
- [instance: 79297401290]: Waiting for QRCode Scan: Attempt 2
- [instance: 79297401290]: Checking QRCode status...
- [instance: 79297401290]: QRCode Success
- [instance: 79297401290]: Checking phone is connected...
- [instance: 79297401290]: Connected
Reboot script
info: [79297401290] Initializing browser wss...
info: [79297401290] Browser successfully opened
info: [79297401290] checking headless...
info: [79297401290] headless option is active, browser hidden
info: [79297401290] Checking page...
info: [79297401290] Page successfully accessed
- [instance: 79297401290]: Waiting page load
- [instance: 79297401290]: Checking is logged...
- [instance: 79297401290]: Waiting for QRCode Scan...
- [instance: 79297401290]: Waiting for QRCode Scan: Attempt 1
- [instance: 79297401290]: Page Closed
- [instance: 79297401290]: Checking QRCode status...
- [instance: 79297401290]: Failed to authenticate
- [instance: 79297401290]: Unknow error
If relevant, paste all of your Log Output
Your Code
const venom = require('venom-bot');
venom
.create({
session: 'session-name', //name of session
multidevice: false // for version not multidevice use false.(default: true)
})
.then((client) => start(client))
.catch((erro) => {
console.log(erro);
});
function start(client) {
client.onMessage((message) => {
if (message.body === 'Hi' && message.isGroupMsg === false) {
client
.sendText(message.from, 'Welcome Venom 🕷')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
}
});
}
Additional context / Screenshot
Add any other context about the problem here. If applicable, add screenshots to help explain.
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (1 by maintainers)
Top Results From Across the Web
PHP Session not Saving - Stack Overflow
session_save_path is defined in php.ini file. Probably in your testing server it is a folder writable by apache but in your server it...
Read more >Fix: PHP sessions not saving. - This Interests Me
A short guide on how to solve the issue of PHP session data not saving. ... guide on the common problems that could...
Read more >PHP: My session variables are not being saved
Since the problem is about the session not being saved, the solution is to save the session before redirecting. How to do that?...
Read more >Problem with saving session - www.neuron.yale.edu
When I first installed Neuron on my laptop with Ubuntu I could save my session, and I could kind of load it, with...
Read more >Firefox doesn't save my session - Mozilla Support
8 replies; 1 has this problem; 1238 views; Last reply by Alex ... hi dr... save a Firefox session, If you are using...
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 FreeTop 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
Top GitHub Comments
For multi device beta, the following config created the tokens for me automatically:
Setting
folderNameToken
,mkdirFolderToken
andcreatePathFileToken
were the magic config that created a large session specific token folder that was reused when restarting the server.For non multi device, you have to save it manually using
client.getSessionTokenBrowser()
and then read it back and pass it as an option tocreate
asbrowserSessionToken
.The following works for both multi device and non:
you can save the session token manually. See here in this script! The comments are in Portuguese, but you can translate the page. OK!?
https://github.com/jrCleber/bot-venom-firebase/blob/main/app/bot.ts
Project developers rarely help us.