Skip to content

No Longer Connects - Unexpected Response, Misdirected Request #22

@zachpino

Description

@zachpino

Thanks for this amazing software!

I had a headless working Sirius client on a Raspberry Pi, which stopped connecting last week with the following error printed to the console when I execute the client file. No changes made to any of the repo's files, and setup following the process on tiny printer.club.

I noticed statusMessage: 'Misdirected Request' in the JSON... has there been a change to the NordProject API?

Thanks for any help or clues. I adore my [fake] little printer and would love to have it back online!

pi@raspberrypi:~/Desktop/little-printer/sirius-client-master/src $ yarn ts-node bin/client.ts run --uri wss://littleprinter.nordprojects.co/api/v1/connection -p PrinterFile.printer -d filesystem
yarn run v1.22.15
$ /home/pi/Desktop/little-printer/sirius-client-master/node_modules/.bin/ts-node bin/client.ts run --uri wss://littleprinter.nordprojects.co/api/v1/connection -p PrinterFile.printer.printer -d filesystem
Contacting wss://littleprinter.nordprojects.co/api/v1/connection
{
  deviceAddress: ####################',
  bridgeAddress: ####################,
  claimCode: ####################
}
-----------------------------
connecting to wss://littleprinter.nordprojects.co/api/v1/connection as: bridge: 39b4569e348ee000, device: ####################
unexpected reponse: {
  param: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      error: [Function (anonymous)],
      response: [Function (anonymous)],
      upgrade: [Function (anonymous)],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: false,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: true,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: false,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'littleprinter.nordprojects.co',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 8,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'littleprinter.nordprojects.co',
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: [HTTPParser],
      _httpMessage: [Circular *1],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 12,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object],
      [Symbol(RequestTimeout)]: undefined
    },
    _header: 'GET /api/v1/connection HTTP/1.1\r\n' +
      'Sec-WebSocket-Version: 13\r\n' +
      'Sec-WebSocket-Key: lfdokzrGWmhO1OyoMVbRhQ==\r\n' +
      'Connection: Upgrade\r\n' +
      'Upgrade: websocket\r\n' +
      'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n' +
      'Host: littleprinter.nordprojects.co\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: undefined,
    socketPath: undefined,
    method: 'GET',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: '/api/v1/connection',
    _ended: false,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      socket: [TLSSocket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: false,
      rawHeaders: [Array],
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 421,
      statusMessage: 'Misdirected Request',
      client: [TLSSocket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 12,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0,
      [Symbol(RequestTimeout)]: undefined
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: HTTPParser {
      '0': null,
      '1': [Function: parserOnHeaders],
      '2': [Function: parserOnHeadersComplete],
      '3': [Function: parserOnBody],
      '4': [Function: parserOnMessageComplete],
      '5': null,
      '6': null,
      _headers: [],
      _url: '',
      socket: [TLSSocket],
      incoming: [IncomingMessage],
      outgoing: [Circular *1],
      maxHeaderPairs: 2000,
      _consumed: false,
      onIncoming: [Function: parserOnIncomingClient],
      [Symbol(owner_symbol)]: [HTTPClientAsyncResource]
    },
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'littleprinter.nordprojects.co',
    protocol: 'https:',
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      'sec-websocket-version': [Array],
      'sec-websocket-key': [Array],
      connection: [Array],
      upgrade: [Array],
      'sec-websocket-extensions': [Array],
      host: [Array]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions