PICTURE / USER_ABOUT / BUTTON_CLICK are accepted in NATS_GLOBAL_EVENTS but never published: missing cases in the NATS switch of SendToGlobalQueues
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start in pkg/whatsmeow/service/whatsmeow.go at SendToGlobalQueues and compare the AMQP mapping with the NATS switch. Check the declarations in pkg/internal/event_types/event_types.go, then ensure Picture, UserAbout, and ButtonClick are mapped for configured NATS events and are published rather than dropped; consider the issue's requested guardrail for unmapped events.
Written by the indexing model from the issue text.
Description
Welcome!
- Yes, I have searched for similar issues on GitHub and found none.
Related but distinct: #105 reports the same class of bug (an event type that is
accepted by configuration but has no case in a dispatch switch), for Passkey*
events on the webhook path. This one is about PICTURE / USER_ABOUT /
BUTTON_CLICK on the NATS path.
What did you do?
Ran 0.7.2 with NATS global events enabled and a subscription list that includes
PICTURE and USER_ABOUT:
NATS_GLOBAL_ENABLED=true
NATS_GLOBAL_EVENTS=MESSAGE,SEND_MESSAGE,READ_RECEIPT,PRESENCE,CHAT_PRESENCE,CALL,CONNECTION,QRCODE,GROUP,CONTACT,LABEL,PICTURE,USER_ABOUT,NEWSLETTER,HISTORY_SYNC
All three values are declared valid in pkg/internal/event_types/event_types.go
(lines 18-20, 37-39, 57-58), so the configuration is accepted without warning.
What did you expect?
Picture and UserAbout events to be published to NATS, since they are in the
subscription list and the gateway does receive them from whatsmeow.
What did you observe instead of what you expected?
They are silently dropped. Over 4 days of a single instance:
| event | received by gateway | published to NATS |
|---|---|---|
Picture |
9 | 0 |
UserAbout |
3 | 0 |
(Event received of type Picture appears in the logs; nothing ever lands in the
consumer.)
Cause
SendToGlobalQueues in pkg/whatsmeow/service/whatsmeow.go has two independent
switch eventType blocks that map whatsmeow event names to global event types.
The AMQP branch maps them (lines 2519-2522):
case "Picture":
globalEventType = "PICTURE"
case "UserAbout":
globalEventType = "USER_ABOUT"
The NATS branch (switch at line 2560) has no such cases, so both fall through
to the default at line 2587:
default:
globalEventType = ""
}
// Verifica se o evento está na lista de eventos globais NATS
if globalEventType != "" && utils.Find(w.config.NatsGlobalEvents, globalEventType) {
globalEventType == "" fails the guard and the event is dropped with no log line.
The result is a dead subscription: configured, accepted, and impossible to
satisfy. BUTTON_CLICK has the same shape — declared in event_types.go and
emitted as a separate ButtonClick event, but absent from the NATS switch.
Suggested fix
Adding the missing cases to the NATS switch would resolve it:
case "Picture":
globalEventType = "PICTURE"
case "UserAbout":
globalEventType = "USER_ABOUT"
case "ButtonClick":
globalEventType = "BUTTON_CLICK"
More robustly, the two switches are the same mapping duplicated and have already
drifted apart — extracting one shared mapEventToGlobalType(eventType) string
used by both branches would prevent the next divergence. I have not sent a PR for
this because the right shape depends on how you would rather handle the
duplication; happy to do it either way if you have a preference.
A cheap guardrail regardless: log at default: in the NATS branch, the way the
AMQP branch already does (Event %s not mapped to global event type). The silent
drop is what makes this hard to notice — the configuration looks correct and
nothing complains.
Version
0.7.2
- Dominant language
- Go
- Stars
- 878
- Forks
- 461
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from evolution-foundation/evolution-go
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
evolution-foundation/evolution-go#97 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Panic (nil pointer) in ReconnectClient kills the whole process - one instance takes down all others Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
All issues in evolution-foundation/evolution-go
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·