matrix-org / mjolnir

A moderation tool for Matrix
Apache License 2.0
319 stars 54 forks source link

Our console errors are really hard to read #168

Closed Yoric closed 4 days ago

Yoric commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

When we have an error, we often see something along the lines of

IncomingMessage {
  _readableState: ReadableState {
    objectMode: false,
    highWaterMark: 16384,
    buffer: BufferList { head: null, tail: null, length: 0 },
    length: 0,
    pipes: null,
    pipesCount: 0,
    flowing: true,
    ended: true,
    endEmitted: true,
    reading: false,
    sync: true,
    needReadable: false,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    emitClose: true,
    autoDestroy: false,
    destroyed: false,
    defaultEncoding: 'utf8',
    awaitDrainWriters: null,
    multiAwaitDrain: false,
    readingMore: true,
    decoder: null,
    encoding: null,
    [Symbol(kPaused)]: false
  },
  readable: false,
  _events: [Object: null prototype] {
    end: [ [Function: responseOnEnd], [Function] ],
    close: [ [Function], [Function] ],
    data: [Function],
    error: [Function]
  },
  _eventsCount: 4,
  _maxListeners: undefined,
  socket: Socket {
    connecting: false,
    _hadError: false,
    _parent: null,
    _host: 'localhost',
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: false,
      endEmitted: false,
      reading: true,
      sync: false,
      needReadable: true,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      emitClose: false,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: false
    },
    readable: true,
    _events: [Object: null prototype] {
      end: [Function: onReadableStreamEnd],
      free: [Function: onFree],
      close: [Array],
      timeout: [Function: onTimeout],
      agentRemove: [Function: onRemove],
      error: [Function: socketErrorListener],
      finish: [Function]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: true,
      needDrain: false,
      ending: true,
      ended: true,
      finished: false,
      destroyed: false,
      decodeStrings: false,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      bufferedRequest: null,
      lastBufferedRequest: null,
      pendingcb: 1,
      prefinished: false,
      errorEmitted: false,
      emitClose: false,
      autoDestroy: false,
      bufferedRequestCount: 0,
      corkedRequestsFree: [Object]
    },
    writable: false,
    allowHalfOpen: false,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    parser: null,
    _httpMessage: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Circular],
      connection: [Circular],
      _header: 'PUT /_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2 HTTP/1.1\r\n' +
        'Authorization: Bearer syt_bWpvbG5pcg_RNuCIQtHeYlDZUahNCag_1wiXJ6\r\n' +
        'Content-Type: application/json\r\n' +
        'host: localhost:8081\r\n' +
        'content-length: 180\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'PUT',
      insecureHTTPParser: undefined,
      path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: [Function: emitRequestTimeout],
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'localhost',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    timeout: 60000,
    [Symbol(asyncId)]: 40755,
    [Symbol(kHandle)]: TCP {
      reading: true,
      onconnection: null,
      [Symbol(owner_symbol)]: [Circular]
    },
    [Symbol(kSetNoDelay)]: false,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: Timeout {
      _idleTimeout: 60000,
      _idlePrev: [TimersList],
      _idleNext: [Timeout],
      _idleStart: 77439,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(refed)]: false,
      [Symbol(kHasPrimitive)]: false,
      [Symbol(asyncId)]: 40765,
      [Symbol(triggerId)]: 40764
    },
    [Symbol(kBuffer)]: null,
    [Symbol(kBufferCb)]: null,
    [Symbol(kBufferGen)]: null,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0
  },
  connection: Socket {
    connecting: false,
    _hadError: false,
    _parent: null,
    _host: 'localhost',
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: false,
      endEmitted: false,
      reading: true,
      sync: false,
      needReadable: true,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      emitClose: false,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: false
    },
    readable: true,
    _events: [Object: null prototype] {
      end: [Function: onReadableStreamEnd],
      free: [Function: onFree],
      close: [Array],
      timeout: [Function: onTimeout],
      agentRemove: [Function: onRemove],
      error: [Function: socketErrorListener],
      finish: [Function]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: true,
      needDrain: false,
      ending: true,
      ended: true,
      finished: false,
      destroyed: false,
      decodeStrings: false,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      bufferedRequest: null,
      lastBufferedRequest: null,
      pendingcb: 1,
      prefinished: false,
      errorEmitted: false,
      emitClose: false,
      autoDestroy: false,
      bufferedRequestCount: 0,
      corkedRequestsFree: [Object]
    },
    writable: false,
    allowHalfOpen: false,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    parser: null,
    _httpMessage: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Circular],
      connection: [Circular],
      _header: 'PUT /_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2 HTTP/1.1\r\n' +
        'Authorization: Bearer syt_bWpvbG5pcg_RNuCIQtHeYlDZUahNCag_1wiXJ6\r\n' +
        'Content-Type: application/json\r\n' +
        'host: localhost:8081\r\n' +
        'content-length: 180\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'PUT',
      insecureHTTPParser: undefined,
      path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: [Function: emitRequestTimeout],
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'localhost',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    timeout: 60000,
    [Symbol(asyncId)]: 40755,
    [Symbol(kHandle)]: TCP {
      reading: true,
      onconnection: null,
      [Symbol(owner_symbol)]: [Circular]
    },
    [Symbol(kSetNoDelay)]: false,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: Timeout {
      _idleTimeout: 60000,
      _idlePrev: [TimersList],
      _idleNext: [Timeout],
      _idleStart: 77439,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(refed)]: false,
      [Symbol(kHasPrimitive)]: false,
      [Symbol(asyncId)]: 40765,
      [Symbol(triggerId)]: 40764
    },
    [Symbol(kBuffer)]: null,
    [Symbol(kBufferCb)]: null,
    [Symbol(kBufferGen)]: null,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0
  },
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  httpVersion: '1.1',
  complete: true,
  headers: {
    server: 'nginx/1.21.4',
    date: 'Thu, 16 Dec 2021 15:05:57 GMT',
    'content-type': 'application/json',
    'transfer-encoding': 'chunked',
    connection: 'close',
    'cache-control': 'no-cache, no-store, must-revalidate',
    'access-control-allow-origin': '*',
    'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, OPTIONS',
    'access-control-allow-headers': 'X-Requested-With, Content-Type, Authorization, Date'
  },
  rawHeaders: [
    'Server',
    'nginx/1.21.4',
    'Date',
    'Thu, 16 Dec 2021 15:05:57 GMT',
    'Content-Type',
    'application/json',
    'Transfer-Encoding',
    'chunked',
    'Connection',
    'close',
    'Cache-Control',
    'no-cache, no-store, must-revalidate',
    'Access-Control-Allow-Origin',
    '*',
    'Access-Control-Allow-Methods',
    'GET, HEAD, POST, PUT, DELETE, OPTIONS',
    'Access-Control-Allow-Headers',
    'X-Requested-With, Content-Type, Authorization, Date'
  ],
  trailers: {},
  rawTrailers: [],
  aborted: false,
  upgrade: false,
  url: '',
  method: null,
  statusCode: 403,
  statusMessage: 'Forbidden',
  client: Socket {
    connecting: false,
    _hadError: false,
    _parent: null,
    _host: 'localhost',
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: false,
      endEmitted: false,
      reading: true,
      sync: false,
      needReadable: true,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      emitClose: false,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: false
    },
    readable: true,
    _events: [Object: null prototype] {
      end: [Function: onReadableStreamEnd],
      free: [Function: onFree],
      close: [Array],
      timeout: [Function: onTimeout],
      agentRemove: [Function: onRemove],
      error: [Function: socketErrorListener],
      finish: [Function]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: true,
      needDrain: false,
      ending: true,
      ended: true,
      finished: false,
      destroyed: false,
      decodeStrings: false,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      bufferedRequest: null,
      lastBufferedRequest: null,
      pendingcb: 1,
      prefinished: false,
      errorEmitted: false,
      emitClose: false,
      autoDestroy: false,
      bufferedRequestCount: 0,
      corkedRequestsFree: [Object]
    },
    writable: false,
    allowHalfOpen: false,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    parser: null,
    _httpMessage: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Circular],
      connection: [Circular],
      _header: 'PUT /_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2 HTTP/1.1\r\n' +
        'Authorization: Bearer syt_bWpvbG5pcg_RNuCIQtHeYlDZUahNCag_1wiXJ6\r\n' +
        'Content-Type: application/json\r\n' +
        'host: localhost:8081\r\n' +
        'content-length: 180\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'PUT',
      insecureHTTPParser: undefined,
      path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: [Function: emitRequestTimeout],
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'localhost',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    timeout: 60000,
    [Symbol(asyncId)]: 40755,
    [Symbol(kHandle)]: TCP {
      reading: true,
      onconnection: null,
      [Symbol(owner_symbol)]: [Circular]
    },
    [Symbol(kSetNoDelay)]: false,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: Timeout {
      _idleTimeout: 60000,
      _idlePrev: [TimersList],
      _idleNext: [Timeout],
      _idleStart: 77439,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(refed)]: false,
      [Symbol(kHasPrimitive)]: false,
      [Symbol(asyncId)]: 40765,
      [Symbol(triggerId)]: 40764
    },
    [Symbol(kBuffer)]: null,
    [Symbol(kBufferCb)]: null,
    [Symbol(kBufferGen)]: null,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0
  },
  _consuming: false,
  _dumped: false,
  req: ClientRequest {
    _events: [Object: null prototype] {
      socket: [Function],
      response: [Function: bound ],
      error: [Array],
      drain: [Function],
      timeout: [Function],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 6,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: null,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'localhost',
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      parser: null,
      _httpMessage: [Circular],
      timeout: 60000,
      [Symbol(asyncId)]: 40755,
      [Symbol(kHandle)]: [TCP],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 60000,
        _idlePrev: [TimersList],
        _idleNext: [Timeout],
        _idleStart: 77439,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 40765,
        [Symbol(triggerId)]: 40764
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    connection: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'localhost',
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      parser: null,
      _httpMessage: [Circular],
      timeout: 60000,
      [Symbol(asyncId)]: 40755,
      [Symbol(kHandle)]: [TCP],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 60000,
        _idlePrev: [TimersList],
        _idleNext: [Timeout],
        _idleStart: 77439,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 40765,
        [Symbol(triggerId)]: 40764
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    _header: 'PUT /_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2 HTTP/1.1\r\n' +
      'Authorization: Bearer syt_bWpvbG5pcg_RNuCIQtHeYlDZUahNCag_1wiXJ6\r\n' +
      'Content-Type: application/json\r\n' +
      'host: localhost:8081\r\n' +
      'content-length: 180\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: noopPendingOutput],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 80,
      protocol: 'http:',
      options: [Object],
      requests: {},
      sockets: [Object],
      freeSockets: {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      maxTotalSockets: Infinity,
      totalSocketCount: 2,
      scheduling: 'fifo',
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'PUT',
    insecureHTTPParser: undefined,
    path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
    _ended: true,
    res: [Circular],
    aborted: false,
    timeoutCb: [Function: emitRequestTimeout],
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'localhost',
    protocol: 'http:',
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      authorization: [Array],
      'content-type': [Array],
      host: [Array],
      'content-length': [Array]
    }
  },
  request: Request {
    _events: [Object: null prototype] {
      error: [Function: bound ],
      complete: [Function: bound ],
      pipe: [Function],
      data: [Function],
      end: [Function]
    },
    _eventsCount: 5,
    _maxListeners: undefined,
    uri: Url {
      protocol: 'http:',
      slashes: true,
      auth: null,
      host: 'localhost:8081',
      port: '8081',
      hostname: 'localhost',
      hash: null,
      search: null,
      query: null,
      pathname: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
      path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
      href: 'http://localhost:8081/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2'
    },
    method: 'PUT',
    useQuerystring: true,
    qsStringifyOptions: { options: [Object] },
    timeout: 60000,
    headers: {
      Authorization: 'Bearer syt_bWpvbG5pcg_RNuCIQtHeYlDZUahNCag_1wiXJ6',
      'Content-Type': 'application/json',
      'content-length': 180
    },
    body: '{"body":"‼ | Startup failed due to error - see console","formatted_body":"‼ | Startup failed due to error - see console","msgtype":"m.notice","format":"org.matrix.custom.html"}',
    callback: [Function],
    readable: true,
    writable: true,
    explicitMethod: true,
    _qs: Querystring {
      request: [Circular],
      lib: [Object],
      useQuerystring: true,
      parseOptions: {},
      stringifyOptions: [Object]
    },
    _auth: Auth {
      request: [Circular],
      hasAuth: false,
      sentAuth: false,
      bearerToken: null,
      user: null,
      pass: null
    },
    _oauth: OAuth { request: [Circular], params: null },
    _multipart: Multipart {
      request: [Circular],
      boundary: '257d3bd8-923c-454c-b8a9-ff128002f428',
      chunked: false,
      body: null
    },
    _redirect: Redirect {
      request: [Circular],
      followRedirect: true,
      followRedirects: true,
      followAllRedirects: false,
      followOriginalHttpMethod: false,
      allowRedirect: [Function],
      maxRedirects: 10,
      redirects: [],
      redirectsFollowed: 0,
      removeRefererHeader: false
    },
    _tunnel: Tunnel {
      request: [Circular],
      proxyHeaderWhiteList: [Array],
      proxyHeaderExclusiveList: []
    },
    setHeader: [Function],
    hasHeader: [Function],
    getHeader: [Function],
    removeHeader: [Function],
    localAddress: undefined,
    pool: {},
    dests: [],
    __isRequestRequest: true,
    _callback: [Function],
    proxy: null,
    tunnel: false,
    setHost: true,
    originalCookieHeader: undefined,
    _disableCookies: true,
    _jar: undefined,
    port: '8081',
    host: 'localhost',
    path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
    httpModule: {
      _connectionListener: [Function: connectionListener],
      METHODS: [Array],
      STATUS_CODES: [Object],
      Agent: [Function],
      ClientRequest: [Function: ClientRequest],
      IncomingMessage: [Function: IncomingMessage],
      OutgoingMessage: [Function: OutgoingMessage],
      Server: [Function: Server],
      ServerResponse: [Function: ServerResponse],
      createServer: [Function: createServer],
      get: [Function: get],
      request: [Function: request],
      maxHeaderSize: [Getter],
      globalAgent: [Getter/Setter]
    },
    agentClass: [Function: Agent] { defaultMaxSockets: Infinity },
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 80,
      protocol: 'http:',
      options: [Object],
      requests: {},
      sockets: [Object],
      freeSockets: {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      maxTotalSockets: Infinity,
      totalSocketCount: 2,
      scheduling: 'fifo',
      [Symbol(kCapture)]: false
    },
    _started: true,
    href: 'http://localhost:8081/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Socket],
      connection: [Socket],
      _header: 'PUT /_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2 HTTP/1.1\r\n' +
        'Authorization: Bearer syt_bWpvbG5pcg_RNuCIQtHeYlDZUahNCag_1wiXJ6\r\n' +
        'Content-Type: application/json\r\n' +
        'host: localhost:8081\r\n' +
        'content-length: 180\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'PUT',
      insecureHTTPParser: undefined,
      path: '/_matrix/client/r0/rooms/%23moderators%3Alocalhost%3A9999/send/m.room.message/1639667157892__inc2',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: [Function: emitRequestTimeout],
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'localhost',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    ntick: true,
    timeoutTimer: null,
    response: [Circular],
    originalHost: 'localhost:8081',
    originalHostHeaderName: 'host',
    responseContent: [Circular],
    _destdata: true,
    _ended: true,
    _callbackCalled: true,
    [Symbol(kCapture)]: false
  },
  toJSON: [Function: responseToJSON],
  caseless: Caseless {
    dict: {
      server: 'nginx/1.21.4',
      date: 'Thu, 16 Dec 2021 15:05:57 GMT',
      'content-type': 'application/json',
      'transfer-encoding': 'chunked',
      connection: 'close',
      'cache-control': 'no-cache, no-store, must-revalidate',
      'access-control-allow-origin': '*',
      'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, OPTIONS',
      'access-control-allow-headers': 'X-Requested-With, Content-Type, Authorization, Date'
    }
  },
  body: { errcode: 'M_FORBIDDEN', error: 'Unknown room' },
  [Symbol(kCapture)]: false
}

(extract from a recent integration test failure)

Instead, we should have:

  1. A clear error message;
  2. A stack trace.

We need to find out how to move towards something readable.

Gnuxie commented 2 years ago

Do we where these come from? I agree, this object that gets pretty printed is usually over 1000 lines long and takes out the entire history in most terminal emulators. So far I guess I've been lucky with it because i usually know where the issue is and can put a breakpoint before it, but it's not good enough

turt2live commented 4 days ago

I'm assuming this is fixed or not an issue anymore. If it continues, please open a new issue.

Note that the error often contains access tokens, which should be revoked if revealed in this way.