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

Error: stream ended unexpectedly #22

Closed
Akash0333 opened this issue Feb 26, 2018 · 13 comments
Closed

Error: stream ended unexpectedly #22

Akash0333 opened this issue Feb 26, 2018 · 13 comments

Comments

@Akash0333
Copy link

Akash0333 commented Feb 26, 2018

I am getting this error i don't know from where i am getting this error and why

screen shot 2018-02-26 at 4 01 39 pm

@dougwilson
Copy link
Contributor

Hm, weird. I would love to take a look and figure it out. Can you help provide instruction on how to reproduce so I can take a look? Provide the following, for example:

  1. Version of Node.js
  2. Version of this and all other used modules
  3. Complete server code I can copy and paste and run to see the issue
  4. Instructions on what request (include a copy of the request or code that creates the request) to make to produce the given error.

Thanks!

@vinyll
Copy link

vinyll commented Mar 28, 2018

Same here

node --version
v9.5.0

pakages.json

"connect-multiparty": "^2.1.0",
 "express": "^4.16.3",

app.js

const express = require('express')
const app = express()
const multipart = require('connect-multiparty')
const multipartMiddleware = multipart()

app.post('/', multipartMiddleware, (req, res) => {
  console.debug(req.body, req.files)
})

raises the following:

Listening on port 3000

Error: stream ended unexpectedly
    at Form.<anonymous> (/Users/vinyll/Projects/eurordis/receipt-sender/node_modules/multiparty/index.js:754:24)
    at Form.emit (events.js:165:20)
    at finishMaybe (_stream_writable.js:633:14)
    at endWritable (_stream_writable.js:641:3)
    at Form.Writable.end (_stream_writable.js:583:5)
    at IncomingMessage.onend (_stream_readable.js:602:10)
    at Object.onceWrapper (events.js:255:19)
    at IncomingMessage.emit (events.js:165:20)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:152:19)

@vinyll
Copy link

vinyll commented Mar 28, 2018

Seems like it occurs when re-submitting the posted form refreshing the page.
Works fine when browsing back and reclicking on the submit button.

@dougwilson
Copy link
Contributor

Hi @vinyll I can definitely take a look. I ran your app, and that error doesn't actually appear. After I copy the app and run it, what are the steps to see the error?

@vinyll
Copy link

vinyll commented Mar 28, 2018

The step to reproduce:

  1. run the app
  2. post some file to /
  3. refresh the page and say "continue" when it's warning about posting data again

The error should raise…

@dougwilson
Copy link
Contributor

I did try that in Chrome and there wasn't an error. I'm hoping that you can possible some more specific instructions if possible. Maybe the code for how to do the post is different between us? Or the web browser?

@vinyll
Copy link

vinyll commented Mar 28, 2018

Good point. I tried with Chromium and Firefox 56 and I had no error risen; it occurs on Firefox 60.

What I do more precisely to reproduce:

  1. run
  2. submit a file
  3. the server loops as there's no response. Ctrl+C to stop the server
  4. restart the server
  5. refresh the page accepting to post again

At this stage I'm wondering if it isn't a bug with FF… :/

@dougwilson
Copy link
Contributor

Ah, gotcha. I will work to get Firefox installed soon and try it out 👍

@dougwilson
Copy link
Contributor

Hi @Akash0333 so I downloaded & installed Firefox 30 and setup my form to do the same thing you described: I have a <form> that makes a POST and then displays "success". I then click on the Reload button and Firefox asks if I want to send the data again. I accept and "success" is displayed again and the form uploaded without an error. Not sure what the difference is between our setups are, though.

Is it possible you can update your above app.js to send an HTML page with a <form> that represents your form? Ideally the less I have to try and make up on the fly, the closer our implementations will get to each other to reproduce the issue.

Also, you're always welcome to submit a fix as a PR as well 👍I want to get this fixed, but I don't (yet) have a way to see the issue to understand what to change.

@vinyll
Copy link

vinyll commented Apr 1, 2018

Hey @dougwilson! Why are you talking about Firefox 30?
I can't see a reference from @Akash0333 about it, but maybe I'm missing some message here.

@dougwilson
Copy link
Contributor

Sorry that was a typo. I meant Firefox 60 (the current version).

@khataha92
Copy link

I have the same issue if I don't send any body from post man to any service. What is the wrong ?? and how to fix it ??

@dougwilson
Copy link
Contributor

Open a new issue with complete code and steps to reproduce the issue so we can figure it out.

@expressjs expressjs locked and limited conversation to collaborators Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants