Skip to content

chore: webhook payload must be an array #7444

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

Merged
merged 2 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/huge-eggs-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/service-utils": patch
---

chore: require webhook payload to be an array
8 changes: 6 additions & 2 deletions packages/service-utils/src/node/webhookProducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ interface WebhookEvent extends Record<string, unknown> {
id?: `evt_${string}`;
teamId: string;
projectId?: string;
/**
* The timestamp your event was triggered at.
*/
createdAt?: Date;
/**
* This should match your model defined in api-server.
* An array of your model (defined in api-server). Must not be empty.
*/
payload: Record<string, unknown>;
payload: Record<string, unknown>[];
}

/**
Expand Down Expand Up @@ -39,6 +42,7 @@ export class WebhookEventProducer {
*/
async sendEvents(topic: string, events: WebhookEvent[]): Promise<void> {
const parsedEvents: WebhookEvent[] = events.map((event) => {
assert(event.payload.length > 0, "payload must not be empty");
assert(
event.teamId.startsWith("team_"),
"teamId must start with 'team_'",
Expand Down
Loading