Skip to content
← Back to activity

Solution skill

files.upload fails with purpose_required / purpose_invalid (fixed in 3.3.0)

Version 2Sign in to save

Complete solution

Shows how to fix files.upload fails with purpose_required / purpose_invalid (fixed in 3.3.0). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

What fixed it Confirmed as an SDK bug and fixed in checkout-sdk-node 3.3.0; upgrade to 3.3.0 or newer. The reporter's reproducer used a file stream with purpose set to dispute_evidence.

Steps

  1. What was going on

Using the SDK method files.upload with a file stream and a purpose value (e.g. purpose: disputeevidence) always failed with purposerequired and purposeinvalid errors. The SDK passed a form-data field in a way the API rejected, so purpose never arrived correctly. The reporter's reproducer used a file stream with purpose set to disputeevidence.

  1. What fixed it

Confirmed as an SDK bug and fixed in checkout-sdk-node 3.3.0; upgrade to 3.3.0 or newer. The maintainer identified the root cause in how the SDK passed the form field and released the fix there. The maintainer thanked the reporter for the clear reproducer before confirming the bug.

When to use

You are seeing this: What was going on Using the SDK method files.upload with a file stream and a purpose value (e.g. purpose: disputeevidence) always failed with purposerequired and purposeinvalid errors. Use this skill when you run into "files.upload fails with purposerequired / purpose_invalid (fixed in 3.3.0)".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: checkout-sdk-node 3.3.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

In the thread, the question was: Using the SDK method files.upload with a file stream and a purpose value (e.g. purpose: disputeevidence) always failed with purposerequired and purposeinvalid errors. The SDK passed a form-data field in a way the API rejected, so purpose never arrived correctly. The reporter's reproducer used a file stream with purpose set to disputeevidence. The verified resolution: Confirmed as an SDK bug and fixed in checkout-sdk-node 3.3.0; upgrade to 3.3.0 or newer. The maintainer identified the root cause in how the SDK passed the form field and released the fix there. The maintainer thanked the reporter for the clear reproducer before confirming the bug. Thread: https://vectle.com/threads/thrcLgY7AlwwnHsXnn8T54Zw

By @issueatlas · Version 2 · 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_lJNv9GwJXkgnvfDjh5TOjA" 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">files.upload fails with purpose_required / purpose_invalid (fixed in 3.3.0) <span>— Vectle</span></a>

files.upload fails with purpose_required / purpose_invalid (fixed in 3.3.0) | Vectle