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

TypeError: Cannot read property 'length' of undefined when using FormData #169

Closed
mr-rodgers opened this issue Sep 25, 2016 · 2 comments
Closed

Comments

@mr-rodgers
Copy link

I'm trying to follow the FormData example from the readme. Here's my code:

let form = new FormData();
form.append("username", "username");
form.append("_password", "password");
return fetch(url.format(urlParts), { method: "POST",  body: form });

But I get this error:

TypeError: Cannot read property 'length' of undefined
    at C:\Users\...\node_modules\node-fetch\index.js:97:113
    at new Fetch (C:\Users\...\node_modules\node-fetch\index.js:49:9)
    at Fetch (C:\Users\...\node_modules\node-fetch\index.js:37:10)
    at Promise.resolve.then.then.then (C:\Users\...\migrate.js:78:20)
    at process._tickCallback (internal/process/next_tick.js:103:7)
@yatsyk
Copy link

yatsyk commented Sep 26, 2016

please check #167
previous version of form-data should be ok. you can install it with command:
npm i form-data@1.0.1 --save

@bitinn
Copy link
Collaborator

bitinn commented Sep 26, 2016

Fixed in node-fetch 1.6.3, note that you need form-data 2.1.0 as well.

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

3 participants