[GOWS] - Channel info / preview by @newsletter id crashes with nil pointer (500) for channels the session does not follow

Aperta
#2,367 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, typescript
Ambito
api, backend

Direzione di ricerca

Start with the GOWS channel info and preview handlers, then trace how they call gows-plus src/server/newsletter.go and its GetNewsletterInfo function. Reproduce with an unfollowed channel’s @newsletter id and compare with an invite code or followed channel. Done means both endpoints return channel data or a useful 4xx error instead of HTTP 500; the implementation is in the external gows-plus dependency.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

On GOWS, GET /api/{session}/channels/{id} and GET /api/{session}/channels/{id}/messages/preview crash with a nil pointer (HTTP 500) when {id} is a ...@newsletter id of a channel the session does not follow. The same calls work with the channel's invite code, and work by @newsletter id for channels the session follows.

Version
{
  "version": "2026.10.1",
  "engine": "GOWS",
  "tier": "CORE"
}

Image devlikeapro/waha:gows-2026.10.1 (linux/amd64), also seen on arm-2026.10.1. GOWS gows-plus v1.0.49.

Steps

  1. A WORKING GOWS session (default) that does not follow the official WhatsApp channel.
  2. GET /api/default/channels/120363144038483540@newsletter
  3. GET /api/default/channels/120363144038483540@newsletter/messages/preview?limit=3&downloadMedia=false
Expected behavior

The channel info and its latest posts (as with the invite code), or a 4xx with the reason if WhatsApp refuses the lookup by id.

Requests - Responses

Both calls return HTTP 500:

13 INTERNAL: Internal server error: runtime error: invalid memory address or nil pointer dereference.

The decoded stack in the message points to github.com/devlikeapro/gows/server.toNewsletter. The session stays WORKING.

  • GET /api/default/channels/0029Va4K0PZ5a245NkngBA2M (invite code of the same channel): 200, correct data.
  • GET /api/default/channels/<id of a followed channel>@newsletter and its /messages/preview: 200.
Additional context

Likely cause, in gows-plus src/server/newsletter.go, GetNewsletterInfo: jid, err := types.ParseJID(id) inside the if block declares a new err, so the error returned by cli.GetNewsletterInfo(ctx, jid) is assigned to that inner variable. The outer err stays nil and toNewsletter(nil) dereferences a nil resp:

var resp *types.NewsletterMetadata
if gows.HasNewsletterSuffix(id) {
    jid, err := types.ParseJID(id) // shadows the outer err
    if err != nil {
        return nil, err
    }
    resp, err = cli.GetNewsletterInfo(ctx, jid) // error lost
} else {
    resp, err = cli.GetNewsletterInfoWithInvite(ctx, id)
}
if err != nil { // outer err, still nil
    return nil, err
}
return toNewsletter(resp), nil // resp == nil

Possible fix: declare var jid types.JID and assign with jid, err = types.ParseJID(id), and return an error when resp == nil. That would surface WhatsApp's actual refusal for unfollowed channels instead of a crash. Happy to open a PR on gows-plus if that helps.

Lingua principale
TypeScript
Stelle
7.6k
Fork
1.8k
Merge medio
4g 20h
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di devlikeapro/waha

Tutte le issue di devlikeapro/waha

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.