j3lte / pastebin-js

NodeJS module for Pastebin API
https://www.npmjs.com/package/pastebin-js
MIT License
57 stars 39 forks source link

Cannot read property 'length' of undefined #13

Closed YanDevDe closed 7 years ago

YanDevDe commented 7 years ago

/home/pi/DiscordBot/EmailBot/node_modules/pastebin-js/lib/methods.js:92
            if (body.length === 0) {
                    ^

TypeError: Cannot read property 'length' of undefined
    at Request._callback (/home/pi/DiscordBot/EmailBot/node_modules/pastebin-js/lib/methods.js:92:21)
    at self.callback (/home/pi/DiscordBot/EmailBot/node_modules/pastebin-js/node_modules/request/request.js:123:22)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Timeout._onTimeout (/home/pi/DiscordBot/EmailBot/node_modules/pastebin-js/node_modules/request/request.js:715:12)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

Not sure why this isn't working. :/ I'm using NodeJS 6.10

I was using this example:

pastebin
  .createPaste("Test from pastebin-js", "pastebin-js")
  .then(function (data) {
    // paste succesfully created, data contains the id
    console.log(data);
  })
  .fail(function (err) {
    // Something went wrong
    console.log(err);
  })
YanDevDe commented 7 years ago

Nevermind, it was my fault