Skip to content

Fails to parse request stream on bun #139

@sean256

Description

@sean256

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

2.1.0

Plugin version

No response

Node.js version

Bun v1.0.15

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

14.0

Description

This is related to

I understand if bun support is beyond the scope of this project, but I did do some exploring. From what I can tell the root issue is in this library (or bun!).

What I did was wrote the failing request stream to a file. Then in the root of this project I stream that file into busboy and listen for fields and files. When running with node the file and field are found. When running with bun neither events are emitted.

At the root

'use strict'

const fs = require('fs')
const Busboy = require('.')

const busboy = new Busboy({
  headers: {
    'content-type': 'multipart/form-data; boundary=__X_PAW_BOUNDARY__'
  }
})

busboy.on('field', function (key) {
  console.log('field found', key)
})
busboy.on('file', function (fieldname, stream) {
  console.log('file found', fieldname)

  stream.on('end', () => {
    console.log(`File [${fieldname}] Finished`)
  })
})
busboy.on('finish', function () {
  console.log('finished')
})

// stream request dump to busboy
const readable = fs.createReadStream('./test/dump')
readable.pipe(busboy)

The request dump: https://drive.google.com/file/d/19_y4fy5pwi6_xDYblHhSp0bEIMhNSiYS/view?usp=share_link

node busboy-test.js
bun busboy-test.js

Steps to Reproduce

Run the above script

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions