WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.6k stars 1.21k forks source link

[BUG] Invalid preKey ID #54

Open satriowicaksn opened 1 year ago

satriowicaksn commented 1 year ago

Describe the bug A clear and concise description of what the bug is. Some of the messages I've received from events['messages.upsert'] have Invalid PreKey ID, does anyone have any idea why this is happening and how to fix it?

To Reproduce Steps to reproduce the behavior:

  1. Created a new connection
  2. Create event listener for events['messages.upsert']
  3. Send message to server number
  4. Some messages have Invalid PreKey ID

Expected behavior Receive the contents of the message according to what we receive on WhatsApp

Environment (please complete the following information):

Additional context This Problem does not occur in all messages

willfeerr commented 1 year ago

Any update? I am facing same issue but inside Jering javascript node, package from dotnet

satriowicaksn commented 1 year ago

No update for this issue :(

satriowicaksn commented 1 year ago

up

satriowicaksn commented 1 year ago

anyone know how to solve this issue ?

IsraelXabregas commented 1 year ago

UP

satriowicaksn commented 1 year ago

UP

dnl4 commented 1 year ago

I encountered this problem today. And it only resolved after I sent the first message.

What I'm thinking of testing: On the mobile phone, set up a welcome message. So, when receiving a first message, the mobile will trigger a response. And from then on, the next messages work normally. It's not the ideal solution, just a temporary fix.

orphancodebr commented 11 months ago

Any update?

okfull commented 11 months ago
auth: {
    creds: state.creds,
    keys: makeCacheableSignalKeyStore(state.keys, logger),
}
roysG commented 5 months ago

Any update?

PurpShell commented 2 months ago

will work on this issue

Xrazik1 commented 1 month ago

I don't quite get why but authState methods request for a pre-key that does not exist in keys and was never set. Here are logs after testing:

Settings keys: setting keys: {"pre-key":{"144":{"private":{"type":"Buffer","data":[0,163,112,193,154,175,125,158,32,72,180,111,115,130,141,236,181,144,185,179,239,250,108,89,75,223,190,238,161,5,209,84]},"public":{"type":"Buffer","data":[79,70,23,71,138,5,159,183,231,196,89,52,38,45,206,14,254,159,243,62,170,17,123,155,96,188,118,147,165,240,151,108]}}}}

Trying to get pre-key immediately after fetching new message upsert: reading key pre-key, ids: 71

Any ideas on why does it happen?

juliancesar commented 1 month ago

up

vitorvk2 commented 1 month ago

up

vitorvk2 commented 1 month ago

same problem

manfe commented 1 month ago

@PurpShell ^ this is losing a lot of messages.

PurpShell commented 1 month ago

1 month later, time to make some serious progress on libsignal

PurpShell commented 1 month ago

looked into this on the libsignal level, found that the prekey chain is getting lost / devoured / deleted somehow

PurpShell commented 1 month ago

there is a quick fix to this for now (stop all deletions on auth store level) but it's better to command it from above on to why invoke deletion of the prekey pairs

DanNisenson commented 1 month ago

do you guys get this using useMultiFileAuthState too? I can't for the life of me figure out why when using an external DB I get the preKeyId error but not when using local files