You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError: Cannot read property 'name' of undefined
Simplest Example to Reproduce
request.post({url: '/cdn/upload',formData: {// Pass a simple key-value pair my_field: 'my_value',// Pass data via Buffers my_buffer: newBuffer([1,2,3]),// Pass data via Streams my_file: fs.createReadStream(__dirname+'/unicycle.jpg'),// Pass multiple values /w an Array attachments: [fs.createReadStream(__dirname+'/attachment1.jpg'),fs.createReadStream(__dirname+'/attachment2.jpg')],// Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS} // Use case: for some types of streams, you'll need to provide "file"-related information manually. // See the `form-data` README for more information about options: https://github.com/form-data/form-data custom_file: {value: fs.createReadStream('/dev/urandom'),options: {filename: 'topsecret.jpg',contentType: 'image/jpeg'}}}}
Current Behavior
TypeError: Cannot read property 'name' of undefined
at FormData._getContentDisposition (/path-to-project/node_modules/request/node_modules/form-data/lib/form_data.js:217:43)
at FormData._multiPartHeader (/path-to-project/node_modules/request/node_modules/form-data/lib/form_data.js:171:33)
at FormData.append (/path-to-project/node_modules/request/node_modules/form-data/lib/form_data.js:64:21)
at appendFormValue (/path-to-project/node_modules/request/request.js:327:21)
at Request.init (/path-to-project/node_modules/request/request.js:338:11)
at new Request (/path-to-project/node_modules/request/request.js:128:8)
at request (/path-to-project/node_modules/request/index.js:54:10)
at Function.post (/path-to-project/node_modules/request/index.js:62:12)
at /path-to-project/publish.js:30:21
at FSReqWrap.oncomplete (fs.js:123:15)
Your Environment
software
version
request
2.81.0, 2.78.0
node
6.10.1
npm
3.10.10
Operating System
MacOS
The text was updated successfully, but these errors were encountered:
This happened me too with version 2.81.0; was my own fault because I was passing an undefined value in the formData. So, considering the code you've written, the problem may stand on the path of files, print them before call the request and check if they are right.
Summary
TypeError: Cannot read property 'name' of undefined
Simplest Example to Reproduce
Current Behavior
Your Environment
The text was updated successfully, but these errors were encountered: