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

node-fetch throws socket hang up #520

Open
NaNraptor opened this issue Nov 16, 2021 · 1 comment
Open

node-fetch throws socket hang up #520

NaNraptor opened this issue Nov 16, 2021 · 1 comment

Comments

@NaNraptor
Copy link

NaNraptor commented Nov 16, 2021

The code below triggers ECONNRESET. I have tried multiple solutions while searching around but nothing helped, any ideas?

const func = (filepath) => {
    const form_data = new FormData()
    form_data.append('file', fs.createReadStream(filepath), {
        knownLength: fs.statSync(filepath).size
    })

    fetch(url, {
        headers: { 'content-type': 'multipart/form-data' },
        method: 'POST',
        body: form_data
    })
}
@jimmywarting
Copy link

see node-fetch/node-fetch#1167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants