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

[Bug]: unexpected end of stream when i use request net and form data with a readStream #35973

Closed
3 tasks done
cloud42repository opened this issue Oct 11, 2022 · 2 comments
Closed
3 tasks done
Labels
blocked/need-repro Needs a test case to reproduce the bug bug 🪲

Comments

@cloud42repository
Copy link

cloud42repository commented Oct 11, 2022

Preflight Checklist

Electron Version

18.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10

What arch are you using?

ia32

Last Known Working Electron version

No response

Expected Behavior

the upload file success with this code

const FormData = require('form-data');
const fs = require('fs-extra');

const form = new FormData();
form.append('name', fs.createReadStream('path'));

var net= require('electron').net
var request = net.request({
method: 'post',
url: 'https://example.org/upload',
headers: headers
});
form.pipe(request);

request.on('response', function(res) {
});

Actual Behavior

const FormData = require('form-data');
const fs = require('fs-extra');

const form = new FormData();
form.append('name', fs.createReadStream('path'));

var net= require('electron').net
var request = net.request({
method: 'post',
url: 'https://example.org/upload',
headers: headers
});
form.pipe(request);

request.on('response', function(res) {
});

i have a server error "unexpected end of stream". Its' possible to have this error when the Content Lenght header is different to size stream. when i use postman or got npm the upload is success.

i see it's impossible to set the content lenght header with net.request

Thanks

Testcase Gist URL

No response

Additional Information

No response

@codebytere codebytere added the blocked/need-repro Needs a test case to reproduce the bug label Oct 12, 2022
@codebytere
Copy link
Member

Thanks for reporting this and helping to make Electron better!

Because of time constraints, triaging code with third-party dependencies is usually not feasible for a small team like Electron's.

Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

I'm adding the blocked/need-repro label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

@clavin
Copy link
Member

clavin commented Oct 12, 2022

This looks like a duplicate of #27895. Closing as a duplicate. Thanks for the report!

@clavin clavin closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/need-repro Needs a test case to reproduce the bug bug 🪲
Projects
None yet
Development

No branches or pull requests

3 participants