Skip to content

fix(worker): skip incoming messages with no storable content instead of failing - #1684

Merged
sung17 merged 1 commit into
mainfrom
fix/worker-drop-unparsed-message
Nov 10, 2026
Merged

sung17 merged 1 commit into
mainfrom
fix/worker-drop-unparsed-message

Conversation

@sung17

@sung17 sung17 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Production worker logs show repeated failures:

SdkException: Unable to parse received message
    at receiveMessage (apps/worker/src/integration/handlers/received-message.ts:375:11)

A channel's receiveMessage parser returns null when a webhook event has nothing to store. Since #1646, Zalo does this on purpose for events with no text or attachment (e.g. oa_send_template, or a media message whose download failed). But the worker still threw on null, so #1646 only moved the throw: the incomingMessage job kept failing and retrying for a non-code issue.

Change

  • apps/worker/src/integration/handlers/received-message.ts: when the parser returns null, log a warning (integrationType, inboxId, workspaceId) and return null instead of throwing. Both callers (integration/worker.ts and thread-control.ts) already treat null as "nothing to do".
  • Added a regression test: a null parse result resolves to null and writes no contact, message or event.

Verification

  • vitest run __tests__/received-message.test.ts: 224 passed
  • pnpm --filter worker check-types: passes
  • pnpm lint: passes

🤖 Generated with Claude Code

…of failing

A channel parser returns null for a webhook event with nothing to store
(e.g. a Zalo oa_send_template with no text or attachment, since #1646).
receiveMessage then threw "Unable to parse received message", so the
incomingMessage job still failed and retried for a non-code issue. Log a
warning with the integration type and inbox, and return null; both callers
already treat null as "nothing to do".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the bug Something isn't working as expected label Nov 10, 2026
@sung17
sung17 merged commit 0afee41 into main Nov 10, 2026
15 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
…of failing (#1684)

A channel parser returns null for a webhook event with nothing to store
(e.g. a Zalo oa_send_template with no text or attachment, since #1646).
receiveMessage then threw "Unable to parse received message", so the
incomingMessage job still failed and retried for a non-code issue. Log a
warning with the integration type and inbox, and return null; both callers
already treat null as "nothing to do".

Co-authored-by: Deathgiver <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant