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

[BUG] sendPresenceUpdate() fails when connecting via QR #893

Open
oscarguindzberg opened this issue Jun 25, 2024 · 2 comments
Open

[BUG] sendPresenceUpdate() fails when connecting via QR #893

oscarguindzberg opened this issue Jun 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@oscarguindzberg
Copy link
Contributor

Describe the bug
chat.ts sendPresenceUpdate() fails when connecting via QR

logger.warn('no name present, ignoring presence update request...')

This is printed on the logs:
{"level":40,"time":"2024-06....","pid":37...,"hostname":"myHost","msg":"no name present, ignoring presence update request..."}

The cause is authState.creds.me.name was not set yet by the time sendPresenceUpdate() is executed.

This is a problem when using markOnlineOnConnect: false because:

  1. The user is seen as "Online" by other users.
  2. Phone notifications are reduced e.g. phone doesn't vibrate on incoming messages.

To Reproduce
Steps to reproduce the behavior:

  • Update example.ts to use markOnlineOnConnect: false
  • Comment out on example.ts these lines:
    • // await sock!.readMessages([msg.key])
    • // await sendMessageWTyping({ text: 'Hello there!' }, msg.key.remoteJid!)
  • Run the example and connect a phone with QR code
  • This will be printed on the logs:
    {"level":40,"time":"2024-06....","pid":37...,"hostname":"myHost","msg":"no name present, ignoring presence update request..."}
  • The user is seen as "Online" by other users.
  • Phone notifications are reduced e.g. phone doesn't vibrate on incoming messages.

Expected behavior

  • No error 40 on the logs
  • The user is NOT seen as "Online" by other users.
  • Phone notifications aren't affected, e.g. phone DOES vibrate on incoming messages.

Environment (please complete the following information):

  • Is this on a server?: no
  • What do your connectOptions look like? : The ones in the example plus markOnlineOnConnect: false
  • Do you have multiple clients on the same IP?: no
  • Are you using a proxy? : no

Additional context
Add any other context about the problem here.

@oscarguindzberg oscarguindzberg added the bug Something isn't working label Jun 25, 2024
oscarguindzberg added a commit to bluepepperok/Baileys that referenced this issue Jun 25, 2024
oscarguindzberg added a commit to oscarguindzberg/Baileys that referenced this issue Jun 25, 2024
@oscarguindzberg
Copy link
Contributor Author

This is a temporary workaround oscarguindzberg@da32b39

@bobslavtriev
Copy link
Contributor

it's not a bug

oscarguindzberg added a commit to bluepepperok/Baileys that referenced this issue Aug 26, 2024
oscarguindzberg added a commit to bluepepperok/Baileys that referenced this issue Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants