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

Cannot calculate proper length in a synchronous way (form-data) #95

Closed
havenchyk opened this issue May 25, 2016 · 1 comment
Closed

Comments

@havenchyk
Copy link

havenchyk commented May 25, 2016

I came across the issue

Error: Cannot calculate proper length in a synchronous way.

What I'm trying to do

 const fileName = 'somename'
 const form = new FormData()

console.log(`- Uploading ${fileName}`)

form.append('name', `${publicUrl}/assets/js/${fileName}`)
form.append('file', fs.createReadStream(filePath))

// form.getLengthSync = null - a known workaround, thanks @mcfedr

fetch(`url`, {
  method: 'POST',
  body: form
})

I know that it's might be a problem with FormData itself, but can we handle somehow this case?

@havenchyk
Copy link
Author

I'm sorry, I just realized that isomorphic-fetch uses node-fetch :) should be handled there

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

1 participant