firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Firebase emulator error "Unexpected end of multipart data"

Open coffeemilkcrazy opened this issue 7 years ago • 22 comments

[REQUIRED] Environment info

7.0.2

macOS

[REQUIRED] Test case

Create cloud function as https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/functions/http/index.js

exports.uploadFile = (req, res) => { please see in the example link above };

run firebase serve

[REQUIRED] Steps to reproduce

Create cloud function as https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/functions/http/index.js

exports.uploadFile = (req, res) => { please see in the example link above };

run firebase serve

Call the function via HTTP POST with Content-Type multipart/form-data

[REQUIRED] Expected behavior

Run cloud function and response

[REQUIRED] Actual behavior

events.js:174 throw er; // Unhandled 'error' event ^

Error: Unexpected end of multipart data at /Users/jarruspong/Downloads/Dev/concordian-api/node_modules/dicer/lib/Dicer.js:62:28 at process._tickCallback (internal/process/next_tick.js:61:11) Emitted 'error' event at: at Busboy.emit (/Users/jarruspong/Downloads/Dev/concordian-api/node_modules/busboy/lib/main.js:38:33) at Dicer. (/Users/jarruspong/Downloads/Dev/concordian-api/node_modules/busboy/lib/types/multipart.js:281:9) at Dicer.emit (events.js:198:13) at Dicer.emit (/Users/jarruspong/Downloads/Dev/concordian-api/node_modules/dicer/lib/Dicer.js:80:35) at /Users/jarruspong/Downloads/Dev/concordian-api/node_modules/dicer/lib/Dicer.js:62:14 at process._tickCallback (internal/process/next_tick.js:61:11)

coffeemilkcrazy avatar Jun 28 '19 07:06 coffeemilkcrazy

@coffeemilkcrazy thanks for filing this! I don't think we've tested multipart before so sounds like a bug. I'll see what @abeisgoat thinks.

samtstern avatar Jun 28 '19 21:06 samtstern

I am having the same problem and downgrading the tools isn't an option. Any clarifications on what the issue actually is? Thanks.

otrv avatar Jul 05 '19 00:07 otrv

Same problem here, having to do all testing against firebase which is very time consuming. Any options to fix this?

hangindan avatar Jul 08 '19 18:07 hangindan

Did anyone find a fix yet?

Salman9000 avatar Jul 11 '19 20:07 Salman9000

Yes #1448 will fix this

samtstern avatar Jul 11 '19 20:07 samtstern

Doesnt seem to work still

Salman9000 avatar Jul 11 '19 20:07 Salman9000

@Salman9000 that fix will be released in version 7.1.0

samtstern avatar Jul 11 '19 20:07 samtstern

Do you happen to know the release time?

Salman9000 avatar Jul 11 '19 21:07 Salman9000

@Salman9000 it will likely be today but we don't offer release timelines. Please subscribe to releases on Github to get notifications.

samtstern avatar Jul 11 '19 21:07 samtstern

It's working now as of firebase-tools 7.10. Thank you so much.

Salman9000 avatar Jul 11 '19 22:07 Salman9000

We just need to upgrade the firebase tools to fix this issue.

Case 1: If you've installed firebase tools as your package dependency, run below code

npm i firebase-tools

Case 2: If you've installed firebase tools as global dependency,run below code

npm i -g firebase-tools

image

just-be-weird avatar Jul 14 '19 10:07 just-be-weird

I'm still getting this issue when serving locally (though not when deploying to Firebase).

using firebase-tools 7.2.2

jakebern avatar Aug 11 '19 01:08 jakebern

I had the same problem and ultimately downgraded firebase-tools to 6.8.0 which is what I'm still on and posting multi-part images locally works fine.

hangindan avatar Aug 11 '19 03:08 hangindan

Now I see this bug: Error: Unexpected end of form at Multipart._final (/workspace/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 onend (node:internal/streams/readable:693:10) at processTicksAndRejections (node:internal/process/task_queues:78:11)

Request header: :authority: us-central1-meua-5d075.cloudfunctions.net :method: POST :path: /app/api/admin/category :scheme: https accept: application/json, text/plain, */* accept-encoding: gzip, deflate, br accept-language: ru,en;q=0.9 content-length: 152440 content-type: multipart/form-data; boundary=----WebKitFormBoundary9xCoP1Y6vrtxLWDW origin: https://me-ua.store referer: https://me-ua.store/ sec-ch-ua: "Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" sec-fetch-dest: empty sec-fetch-mode: cors sec-fetch-site: cross-site user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFkbWluQG1lLnVhIiwicGFzc3dvcmQiOiI2MzM0M2IxZjM2MTE5MTI5MGM1ODIyM2QiLCJpYXQiOjE2Njk0MTk4MDEsImV4cCI6MTY2OTQyMzQwMX0.ldUSiemBPZ7AzHcQv9TBvx-0U2lmxU1LUvlRd4_4JIw

krivonosov11 avatar Nov 25 '22 23:11 krivonosov11

@krivonosov11 any luck with that?

maksympas avatar Nov 29 '22 14:11 maksympas

Also running into this. Not sure if I'm doing something wrong or if the bug has reintroduced itself

mecwerks avatar Nov 29 '22 19:11 mecwerks

I just use heroku hosting 😁

krivonosov11 avatar Nov 29 '22 20:11 krivonosov11

Same problem here, any fix for this? I'm on firebase-tools 11.14.4

Now I see this bug: Error: Unexpected end of form at Multipart._final (/workspace/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 onend (node:internal/streams/readable:693:10) at processTicksAndRejections (node:internal/process/task_queues:78:11)

Request header: :authority: us-central1-meua-5d075.cloudfunctions.net :method: POST :path: /app/api/admin/category :scheme: https accept: application/json, text/plain, */* accept-encoding: gzip, deflate, br accept-language: ru,en;q=0.9 content-length: 152440 content-type: multipart/form-data; boundary=----WebKitFormBoundary9xCoP1Y6vrtxLWDW origin: https://me-ua.store referer: https://me-ua.store/ sec-ch-ua: "Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" sec-fetch-dest: empty sec-fetch-mode: cors sec-fetch-site: cross-site user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFkbWluQG1lLnVhIiwicGFzc3dvcmQiOiI2MzM0M2IxZjM2MTE5MTI5MGM1ODIyM2QiLCJpYXQiOjE2Njk0MTk4MDEsImV4cCI6MTY2OTQyMzQwMX0.ldUSiemBPZ7AzHcQv9TBvx-0U2lmxU1LUvlRd4_4JIw

brightmileDaniel avatar Dec 15 '22 08:12 brightmileDaniel

Same issue with firebase-tools 11.18.0

KostiaLevchenko avatar Dec 15 '22 12:12 KostiaLevchenko

same issue with firebase-tools, do you have a version that works with that?

NetanelRotem avatar Dec 15 '22 14:12 NetanelRotem