sendBatch - Message cannot be undefined

Hey all, I'm having a major issue with the sendBatch API. It's consistently throwing an error Message body cannot be undefined . But I log out the array and there are no undefined objects in the array 🧵
1 Reply
ra
raOP•2mo ago
These payload items seem to work fine when I use send insetad of sendBatch (until I hit the API request limit) I also tried reducing my batch size to 4 as well, and didn't have any luck (same issue) Can share code snippets or anything else that may help, but the logic is pretty trivial. I think it's payload related. I think I found the issue, the API is just kind of unintuitive:
interface Queue<Body = unknown> {
send(body: Body, options?: QueueSendOptions): Promise<void>;
sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;
}
interface Queue<Body = unknown> {
send(body: Body, options?: QueueSendOptions): Promise<void>;
sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;
}
I would have expected this to be:
interface Queue<Body = unknown> {
send(body: Body, options?: QueueSendOptions): Promise<void>;
sendBatch(messages: Iterable<Body>, options?: QueueSendBatchOptions): Promise<void>;
}
interface Queue<Body = unknown> {
send(body: Body, options?: QueueSendOptions): Promise<void>;
sendBatch(messages: Iterable<Body>, options?: QueueSendBatchOptions): Promise<void>;
}

Did you find this page helpful?