7

The thing is that prototype is not defined , although in the node console writing http.IncomingMessage.prototype does give an object as an output. Any Ideas ?

var req = Object.create(http.IncomingMessage.prototype)


Uncaught TypeError: Cannot read property 'prototype' of undefined
at http://localhost:62625/____wallaby-bundle.js?1501265946287&wallabyFileId=bundle:219253
Jerzy Gruszka
  • 1,629
  • 4
  • 15
  • 20

1 Answers1

10

I think http.IncomingMessage is undefined.

It may happened http has been overridden some where in your code .

var http = require('http');
var req = Object.create(http.IncomingMessage.prototype)

I have tested the above code and it works.

Neo
  • 3,309
  • 7
  • 35
  • 44
Sridhar
  • 221
  • 1
  • 8
  • I have the same issue: ''' var http = __webpack_require__(968); var fresh = __webpack_require__(958); var parseRange = __webpack_require__(961); var parse = __webpack_require__(905); var proxyaddr = __webpack_require__(964); /** * Request prototype. * @public */ var req = Object.create(http.IncomingMessage.prototype – Jerzy Gruszka Aug 14 '17 at 11:22
  • webpack bundle http module with id of `968`. Can you just check http module has been included in you webpack bundle. – Sridhar Aug 14 '17 at 11:38
  • Here is the bundle .js file. The http module seems to be included, but it still does not work :( https://ufile.io/sot8h Line 235912 – Jerzy Gruszka Aug 14 '17 at 12:11