Skip to content

The node crashes when receives stream requests #59

@aaitor

Description

@aaitor

Describe the bug

The node crashes when receives stream requests

To Reproduce

Any of this code integrations to use the upload endpoints kill the node service

             const stream = createReadStream(data)
             form.append('file', stream)

// OR

            const stream = new ReadableStreamBuffer({
                frequency: 10,      // in milliseconds.
                chunkSize: 2048     // in bytes.
              })
            stream.put(data, "utf8")
            form.append('file', stream)
            
// OR 

            const stream = new Readable()
            // // eslint-disable-next-line @typescript-eslint/no-empty-function
            stream._read = () => {} // _read is required but you can noop it
            stream.push(buffer)
            stream.push(null)
            form.append('file', stream)
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: Unexpected end of form
    at Multipart._final (/node_modules/busboy/lib/types/multipart.js:588:17)
    at callFinal (node:internal/streams/writable:696:27)
    at prefinish (node:internal/streams/writable:725:7)
    at finishMaybe (node:internal/streams/writable:735:5)
    at Multipart.Writable.end (node:internal/streams/writable:633:5)
    at IncomingMessage.onend (node:internal/streams/readable:693:10)
    at Object.onceWrapper (node:events:627:28)
    at IncomingMessage.emit (node:events:525:35)
    at IncomingMessage.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1358:12)
Emitted 'error' event on FileStream instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

The node returns a HTTP error code and don't die

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrefactor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions