Skip to content

fix: use native FormData instead of formdata-node polyfill#129

Closed
bryantgillespie wants to merge 1 commit intomainfrom
bry/fix-formdata-node-compat
Closed

fix: use native FormData instead of formdata-node polyfill#129
bryantgillespie wants to merge 1 commit intomainfrom
bry/fix-formdata-node-compat

Conversation

@bryantgillespie
Copy link
Copy Markdown
Collaborator

Summary

  • Removes formdata-node polyfill in favor of native FormData (available since Node 18)
  • Fixes file upload failures ("type" is required errors) on Node 22+

Problem

formdata-node's FormData class is not recognized by Node's native fetch. When passed as a request body, it serializes as "[object FormData]" instead of proper multipart data. Directus receives a broken body with no fields and rejects with Invalid payload. "type" is required.

Test plan

  • Apply a template with files on Node 22+
  • Verify file uploads succeed without "type" is required errors

formdata-node's FormData is not recognized by Node's native fetch,
causing the body to serialize as "[object FormData]" instead of
proper multipart data. This breaks file uploads on Node 22+.

Native FormData has been available since Node 18 (our minimum).
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.

1 participant