-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUG] creds.json broke after some reconnections. #794
Comments
+1 |
2 similar comments
+1 |
This comment has been minimized.
This comment has been minimized.
help me |
👍🏽 Upvote! This issue deserves attention. |
Good one! this is a serious issue. |
This comment has been minimized.
This comment has been minimized.
Nice! After all, i've tested some ways to fix this. And you can fix the broken json by erasing all the characters after the penutimate brace. With the json fixed, you can just reconnect and all will work fine. You don't need to read the qr_code again. |
This won't always fix broken json as there might still be missing closing brackets and such so I wouldn't rely on that. Are you guys closing the whole process using something like sigkill or just normally having it reconnect during disconnects? |
It occurs in both cases. After a few times making a new connection ignoring the another error statuses or just killing the process with ctrl+c. |
Force killing a process is not a good idea, you most likely have killed the process when it was still writing the file. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
My solution for now is this
|
Actually my creds.json is saved in the cloud so when the creds in bot breaks it will show the qr if that happens my function will replace the creds with the working file from cloud. or you can just save a backup creds.json file in the bot itselff and do as I did |
So when do we exactly need to call this function, when the connection state is "open" ? |
I have a loop that keeps checking every 6 seconds, verifying the file, because there are no events. |
Didn't work |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Also experiencing the issue a.replace(/}"(lastPropHash)/g, ',"$1') that one helped |
@SheIITear or it's because The file system (and nodejs) doesn't care about concurrent writes, and because on I'll look at |
If you can, it will help a lot, I'm not using the latest versions precisely because of this problem, I'm using 6.6.1 |
Here you're! |
Here I was having this problem and testing your PR solved the problem, thank you! |
The disconnect problem started after this change: |
keepAliveIntervalMs: 999999, |
How about we buffer this event? |
event better.. it might affect memory, but it will prevent the JSON from breaking |
Make sense, it'll help in the file storage and any remote storages to reduce number of I've checked the |
The fix is available in the latest github version (not in npm yet). Remember to use provided |
* fix(master): linting * fix(master): linting warnings * Make "logger" optional (#772) * fix: downloadMediaMessage return type matched parameter (#757) * fix: downloadMediaMessage return type matched parameter * chore: keyword-spacing eslint rule warn instead of error * chore: linting aaaaaaaaaaaaaaaaaaaa * feat(add-routing-info): initial commit (#773) * feat(add-logger): initial commit (#777) * Remove predefinedLabels (#770) * Remove predefinedLabels If the user doesn't delete the label from the WA business, it's not a problem. but it will be a problem when the user deletes the default label, it remains in store but doesn't exist in WA * fix linting * fix trailing * Update chats.ts --------- Co-authored-by: Rajeh Taher <rajeh@reforward.dev> * fix shouldIgnoreJid not receiving app state keys (#792) * fix(master): linting and making functionality better * Update messages-recv.ts * Update baileys-version.json * Fix linter != to !== (#834) * Use message-receipt.update for status@broadcast events (#833) * Lock file on save and read (#824) Fix #794 * feat: add event that handles join approval requests (#802) * initial commit * lint * add type in method * add more actions / fixes participant jid / rename event * fixes * more fixes * fix typing * change 'reject' to 'rejected' * chore:linting --------- Co-authored-by: Rajeh Taher <rajeh@reforward.dev> * chore(release): v6.7.3 --------- Co-authored-by: allburov <allburov@gmail.com> Co-authored-by: arthur simas <arthursimas1@gmail.com> Co-authored-by: azudin <azudin.daem@gmail.com> Co-authored-by: vini <91087061+vinikjkkj@users.noreply.github.com> Co-authored-by: ShellTear <shelltear1337@gmail.com> Co-authored-by: Wender Teixeira <unktools@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Describe the bug
Actually, i've been ignoring status codes diferent than 401 and reconecting the session. But after some reconnections the creds.json broke and the session is lost. But funny, when you fix the json the connection normalize again.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It was expected to maintan the session running.
Environment (please complete the following information):
connectOptions
look like?´´´
{
printQRInTerminal: true,
auth: state,
keepAliveIntervalMs: 999999,
browser: Browsers.macOS("Desktop"),
syncFullHistory: false,
logger: pino({ level: "fatal" }),
linkPreviewImageThumbnailWidth: 852,
generateHighQualityLinkPreview: true,
options: {
timeout: 15 * 1000,
},
}
´´´
The text was updated successfully, but these errors were encountered: