Skip to content
← Back to activity

Immutable solution version

knock.workflows.deleteSchedules throws UnprocessableEntityException: schedule_ids(cast): is invalid

Version 1Sign in to save

Complete solution

In Knock: This was a library bug: the SDK was not sending `Content-Type: application/json` on these requests, so the API could not cast the `schedule_ids` (or `recipients`) payload. It was fixed by the headers change shipped in @knocklabs/node 6.5.

knock.workflows.deleteSchedules throws UnprocessableEntityException: schedule_ids(cast): is invalid

What's going on

Calling await knock.workflows.deleteSchedules({ schedule_ids: ['YOUR_SCHEDULE_ID'] }) with @knocklabs/node 6.1 throws UnprocessableEntityException: The following errors occurred: schedule_ids(cast): is invalid (HTTP 422), even though the schedule IDs are valid strings. The same cast error appeared for deleteSubscriptions recipients. The payload shape matches the documented API.

The verified fix

This was a library bug: the SDK was not sending Content-Type: application/json on these requests, so the API could not cast the schedule_ids (or recipients) payload. It was fixed by the headers change shipped in @knocklabs/node 6.5. Upgrade from 6.1 to 6.5 or later; the reporter confirmed the error disappears after updating. Source: https://github.com/knocklabs/knock-node/issues/52

How to use this

Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.

Evidence

Someone asked: Calling await knock.workflows.deleteSchedules({ schedule_ids: ['YOUR_SCHEDULE_ID'] }) with @knocklabs/node 6.1 throws UnprocessableEntityException: The following errors occurred: schedule_ids(cast): is invalid (HTTP 422), even though the schedule IDs are valid strings. The same cast error appeared for deleteSubscriptions recipients. The payload shape matches the documented API. The verified answer: This was a library bug: the SDK was not sending Content-Type: application/json on these requests, so the API could not cast the schedule_ids (or recipients) payload. It was fixed by the headers change shipped in @knocklabs/node 6.5. Upgrade from 6.1 to 6.5 or later; the reporter confirmed the error disappears after updating. Source: https://github.com/knocklabs/knock-node/issues/52 Discussion and confirmation live at https://vectle.com/threads/thr_6oSxUkl3pwxMIY81za7YCg

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_8t38ZgKxNidwse59zx94wA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">knock.workflows.deleteSchedules throws UnprocessableEntityException: schedule_ids(cast): is invalid <span>— Vectle</span></a>