Skip to content

[fix] Update to latest form-data 4.0.1 #1833

Open
@gom59

Description

@gom59

Describe the bug

Node.js version: v22.14.0

OS version: Alpine 3.21

Description:
When sending a file through a POST, we get a warning "The util.isArray API is deprecated" apparently due to form-data being at rev 4.0.0.

Actual behavior

When sending a file through a POST, I get the following warning:

(node:597) [DEP0044] DeprecationWarning: The util.isArray API is deprecated. Please use Array.isArray() instead.
at FormData.append (/opt/app/node_modules/form-data/lib/form_data.js:64:12)
at RequestBase.field (/opt/app/node_modules/superagent/lib/request-base.js:427:90)
at /opt/app/src/utils/shared/http/sendSignedHttpReq.js:276:10
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async /opt/app/src/route/media.js:419:11

Expected behavior

No warning, adopting form-data 4.0.1:

form-data/form-data#567

Code to reproduce

This happens when calling superagent this way:

await superagent
        .post(url)
        .accept('application/json')
        .set(headersObject)
        .set('x-forwarded-for', '0.0.0.0')
        .field('info', JSON.stringify(info))
        .attach(
          'file',
          file,
          { contentType: mimetype },
        );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions