koajs / discussions

KoaJS Discussions
2 stars 2 forks source link

Uncaught `TypeError: Cannot read property 'hasHeader' of undefined` error #7

Open noway opened 4 years ago

noway commented 4 years ago

Stacktrace:

TypeError: Cannot read property 'hasHeader' of undefined
  File "/home/ubuntu/turnout/turnoutapi/node_modules/koa/lib/response.js", line 436, col 28, in Object.has
    return typeof this.res.hasHeader === 'function'
  File "/home/ubuntu/turnout/turnoutapi/node_modules/koa/lib/response.js", line 204, col 14, in Object.get length [as length]
    if (this.has('Content-Length')) {
  File "/home/ubuntu/turnout/turnoutapi/node_modules/koa-logger/index.js", line 77, col 33, in logger
    const length = ctx.response.length
  File "async /home/ubuntu/turnout/turnoutapi/src/error.service.js", line 10, col 9, in null.<anonymous>
  File "async /home/ubuntu/turnout/turnoutapi/src/index.js", line 49, col 9, in null.<anonymous>

Version:

    "koa": "^2.11.0",

Affects: Doesn't seem to break anything, but gets logged a bunch in my error logging (Sentry)