Skip to content
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

Use alternatives to formData from undici for processing form data #331

Open
timtucker opened this issue Feb 16, 2025 · 0 comments
Open

Use alternatives to formData from undici for processing form data #331

timtucker opened this issue Feb 16, 2025 · 0 comments

Comments

@timtucker
Copy link

Undici v5 is EOL as of April 30, 2025.

In v6, the formData() method on responses was marked as deprecated.

It's still there in v7, but presumably will be dropped in a future release.

Azure Functions should use the approach suggested by Undici:
https://github.com/nodejs/undici/blob/v6.21.1/types/fetch.d.ts

/**
   * @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
   * It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:
   *
   * @example
   * ```js
   * import { Busboy } from '@fastify/busboy'
   * import { Readable } from 'node:stream'
   *
   * const response = await fetch('...')
   * const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })
   *
   * // handle events emitted from `busboy`
   *
   * Readable.fromWeb(response.body).pipe(busboy)
   * ```
   */
  readonly formData: () => Promise<FormData>

This issue goes into the reasons why they suggest using the approach above:
nodejs/undici#2890

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

No branches or pull requests

1 participant