Skip to content

fix(pubsub): map daprd bulk publish entryId into failedMessages - #937

Open
ParthKadam11 wants to merge 5 commits into
dapr:mainfrom
ParthKadam11:fix/bulk-publish-entryid-mismatch
Open

ParthKadam11 wants to merge 5 commits into
dapr:mainfrom
ParthKadam11:fix/bulk-publish-entryid-mismatch

Conversation

@ParthKadam11

Copy link
Copy Markdown

Description

publishBulk could return { failedMessages: [] } when the sidecar reported failures.

daprd's HTTP bulk publish response uses json:"entryId" (pkg/api/http/responses.go), but the SDK only matched entryID. Failed entry IDs never lined up with the request, so every failure was dropped.

Fix: resolve entry.entryId ?? entry.entryID in getBulkPublishResponse, and accept both names on the API response type. Tests now cover the daprd-shaped payload (and HTTP pubsub mocks use entryId).

Test: (92 passed)

npx jest --runInBand --coverage=false test/unit/utils/Client.util.test.ts test/unit/protocols/http/pubsub.test.ts

Issue reference

Please reference the issue this PR will close: #703

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

daprd's HTTP bulk publish response uses json:"entryId", but the SDK only
matched entryID, so real sidecar failures produced an empty failedMessages
array. Accept both field names and cover the daprd-shaped response in tests.

Signed-off-by: ParthKadam11 <parthkadamalt@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 15:56
@ParthKadam11
ParthKadam11 requested review from a team as code owners October 31, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical error-handling regression makes HTTP publish failures with JSON bodies lacking failedEntries appear successful; the fallback must be restored and covered by an HTTP regression test.

1 open issue

Review effort: Balanced

Comment thread src/utils/Client.util.ts Outdated
failedMessages:
params.response.failedEntries.flatMap((entry) => {
const message = params.entries.find((message) => message.entryID === entry.entryID);
params.response.failedEntries?.flatMap((entry) => {

@WhitWaldo WhitWaldo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please address Copilot's feedback?

…s missing

Updated the bulk publish response handling to throw an error if failedEntries is not present, ensuring that the HTTP error handling correctly marks all entries as failed. Added a test case to verify this behavior.

Signed-off-by: ParthKadam11 <parthkadamalt@gmail.com>
@ParthKadam11
ParthKadam11 force-pushed the fix/bulk-publish-entryid-mismatch branch from 0ed54a6 to 74f4295 Compare November 5, 2026 16:06
@ParthKadam11

Copy link
Copy Markdown
Author

dropped the ?. and added a test for error JSON without failedEntries

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

publishBulk silently fails on HTTP 500 errors - returns empty failedMessages array

3 participants