Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StartRecording throws an uncatchable axios error #22

Closed
alex-bluetrain opened this issue Mar 3, 2022 · 2 comments · Fixed by #124
Closed

StartRecording throws an uncatchable axios error #22

alex-bluetrain opened this issue Mar 3, 2022 · 2 comments · Fixed by #124

Comments

@alex-bluetrain
Copy link

I'm running livekit-server-sdk 0.5.9 and livekit-server v0.15.5 in service mode with redis

when I try to startRecording using the server-sdk-js and no recorders are available, I get a huge error being thrown by axios, that cannot be catched.

here's a snip of the code I use

'use strict';
const lksdk = require('livekit-server-sdk');
const RecordingServiceClient = require("livekit-server-sdk/dist/RecordingServiceClient").default
const RecordingTemplate = require('livekit-server-sdk/dist/proto/livekit_recording').RecordingTemplate;
const recService = new RecordingServiceClient("http://livekit:7880", process.env.LIVEKIT_API_KEY, process.env.LIVEKIT_API_SECRET);

async function startRecording(roomName) {
  const filename = roomName + ".mp4";
  const tpl = RecordingTemplate.fromJSON({
    layout: "grid-dark",
    roomName: roomName,
  });

  try {
    await recService.startRecording(tpl, filename);
  } catch (e) {
    console.log("error recording:", e);
  }
}

the error being thrown by axios is not catched at all, even though I startRecording() in a try/catch block

here's the complete error I get (it's huge)
 /app/node_modules/axios/lib/core/createError.js:16
   var error = new Error(message);
               ^

 Error: Request failed with status code 500
     at createError (/app/node_modules/axios/lib/core/createError.js:16:15)
     at settle (/app/node_modules/axios/lib/core/settle.js:17:12)
     at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:269:11)
     at IncomingMessage.emit (node:events:402:35)
     at endReadableNT (node:internal/streams/readable:1343:12)
     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
   config: {
     url: '/twirp/livekit.RecordingService/StartRecording',
     method: 'post',
     data: '{"template":{"layout":"grid-dark","roomName":"NT0C5SD2HCWS5KO8SHJEO","baseUrl":""},"filepath":"NT0C5SD2HCWS5KO8SHJEO.mp4"}',
     headers: {
       Accept: 'application/json, text/plain, */*',
       'Content-Type': 'application/json',
       Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0',
       'User-Agent': 'axios/0.21.4',
       'Content-Length': 122
     },
     baseURL: 'http://livekit:7880',
     transformRequest: [ [Function: transformRequest] ],
     transformResponse: [ [Function: transformResponse] ],
     timeout: 0,
     adapter: [Function: httpAdapter],
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     maxBodyLength: -1,
     validateStatus: [Function: validateStatus],
     transitional: {
       silentJSONParsing: true,
       forcedJSONParsing: true,
       clarifyTimeoutError: false
     }
   },
   request: <ref *1> ClientRequest {
     _events: [Object: null prototype] {
       abort: [Function (anonymous)],
       aborted: [Function (anonymous)],
       connect: [Function (anonymous)],
       error: [Function (anonymous)],
       socket: [Function (anonymous)],
       timeout: [Function (anonymous)],
       prefinish: [Function: requestOnPrefinish]
     },
     _eventsCount: 7,
     _maxListeners: undefined,
     outputData: [],
     outputSize: 0,
     writable: true,
     destroyed: false,
     _last: true,
     chunkedEncoding: false,
     shouldKeepAlive: false,
     maxRequestsOnConnectionReached: false,
     _defaultKeepAlive: true,
     useChunkedEncodingByDefault: true,
     sendDate: false,
     _removedConnection: false,
     _removedContLen: false,
     _removedTE: false,
     _contentLength: null,
     _hasBody: true,
     _trailer: '',
     finished: true,
     _headerSent: true,
     _closed: false,
     socket: <ref *2> Socket {
       connecting: false,
       _hadError: false,
       _parent: null,
       _host: 'livekit',
       _readableState: ReadableState {
         objectMode: false,
         highWaterMark: 16384,
         buffer: BufferList { head: null, tail: null, length: 0 },
         length: 0,
         pipes: [],
         flowing: true,
         ended: false,
         endEmitted: false,
         reading: true,
         constructed: true,
         sync: false,
         needReadable: true,
         emittedReadable: false,
         readableListening: false,
         resumeScheduled: false,
         errorEmitted: false,
         emitClose: false,
         autoDestroy: true,
         destroyed: false,
         errored: null,
         closed: false,
         closeEmitted: false,
         defaultEncoding: 'utf8',
         awaitDrainWriters: null,
         multiAwaitDrain: false,
         readingMore: false,
         dataEmitted: true,
         decoder: null,
         encoding: null,
         [Symbol(kPaused)]: false
       },
       _events: [Object: null prototype] {
         end: [Function: onReadableStreamEnd],
         free: [Function: onFree],
         close: [ [Function: onClose], [Function: socketCloseListener] ],
         timeout: [Function: onTimeout],
         agentRemove: [Function: onRemove],
         error: [Function: socketErrorListener],
         finish: [Function: bound onceWrapper] { listener: [Function: destroy] }
       },
       _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,
         buffered: [],
         bufferedIndex: 0,
         allBuffers: true,
         allNoop: true,
         pendingcb: 1,
         constructed: true,
         prefinished: false,
         errorEmitted: false,
         emitClose: false,
         autoDestroy: true,
         errored: null,
         closed: false,
         closeEmitted: false,
         [Symbol(kOnFinished)]: []
       },
       allowHalfOpen: false,
       _sockname: null,
       _pendingData: null,
       _pendingEncoding: '',
       server: null,
       _server: null,
       parser: null,
       _httpMessage: [Circular *1],
       [Symbol(async_id_symbol)]: 282,
       [Symbol(kHandle)]: TCP {
         reading: true,
         onconnection: null,
         [Symbol(owner_symbol)]: [Circular *2]
       },
       [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(RequestTimeout)]: undefined
     },
     _header: 'POST /twirp/livekit.RecordingService/StartRecording HTTP/1.1\r\n' +
       'Accept: application/json, text/plain, */*\r\n' +
       'Content-Type: application/json\r\n' +
       'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0\r\n' +
       'User-Agent: axios/0.21.4\r\n' +
       'Content-Length: 122\r\n' +
       'Host: livekit:7880\r\n' +
       'Connection: close\r\n' +
       '\r\n',
     _keepAliveTimeout: 0,
     _onPendingData: [Function: nop],
     agent: Agent {
       _events: [Object: null prototype] {
         free: [Function (anonymous)],
         newListener: [Function: maybeEnableKeylog]
       },
       _eventsCount: 2,
       _maxListeners: undefined,
       defaultPort: 80,
       protocol: 'http:',
       options: [Object: null prototype] { path: null },
       requests: [Object: null prototype] {},
       sockets: [Object: null prototype] {
         'livekit:7880:': [
           <ref *2> Socket {
             connecting: false,
             _hadError: false,
             _parent: null,
             _host: 'livekit',
             _readableState: [ReadableState],
             _events: [Object: null prototype],
             _eventsCount: 7,
             _maxListeners: undefined,
             _writableState: [WritableState],
             allowHalfOpen: false,
             _sockname: null,
             _pendingData: null,
             _pendingEncoding: '',
             server: null,
             _server: null,
             parser: null,
             _httpMessage: [Circular *1],
             [Symbol(async_id_symbol)]: 282,
             [Symbol(kHandle)]: [TCP],
             [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(RequestTimeout)]: undefined
           }
         ]
       },
       freeSockets: [Object: null prototype] {},
       keepAliveMsecs: 1000,
       keepAlive: false,
       maxSockets: Infinity,
       maxFreeSockets: 256,
       scheduling: 'lifo',
       maxTotalSockets: Infinity,
       totalSocketCount: 1,
       [Symbol(kCapture)]: false
     },
     socketPath: undefined,
     method: 'POST',
     maxHeaderSize: undefined,
     insecureHTTPParser: undefined,
     path: '/twirp/livekit.RecordingService/StartRecording',
     _ended: true,
     res: IncomingMessage {
       _readableState: ReadableState {
         objectMode: false,
         highWaterMark: 16384,
         buffer: BufferList { head: null, tail: null, length: 0 },
         length: 0,
         pipes: [],
         flowing: true,
         ended: true,
         endEmitted: true,
         reading: false,
         constructed: true,
         sync: true,
         needReadable: false,
         emittedReadable: false,
         readableListening: false,
         resumeScheduled: false,
         errorEmitted: false,
         emitClose: true,
         autoDestroy: true,
         destroyed: true,
         errored: null,
         closed: true,
         closeEmitted: true,
         defaultEncoding: 'utf8',
         awaitDrainWriters: null,
         multiAwaitDrain: false,
         readingMore: true,
         dataEmitted: true,
         decoder: null,
         encoding: null,
         [Symbol(kPaused)]: false
       },
       _events: [Object: null prototype] {
         end: [ [Function: responseOnEnd], [Function: handleStreamEnd] ],
         data: [Function: handleStreamData],
         error: [Function: handleStreamError]
       },
       _eventsCount: 3,
       _maxListeners: undefined,
       socket: <ref *2> Socket {
         connecting: false,
         _hadError: false,
         _parent: null,
         _host: 'livekit',
         _readableState: ReadableState {
           objectMode: false,
           highWaterMark: 16384,
           buffer: BufferList { head: null, tail: null, length: 0 },
           length: 0,
           pipes: [],
           flowing: true,
           ended: false,
           endEmitted: false,
           reading: true,
           constructed: true,
           sync: false,
           needReadable: true,
           emittedReadable: false,
           readableListening: false,
           resumeScheduled: false,
           errorEmitted: false,
           emitClose: false,
           autoDestroy: true,
           destroyed: false,
           errored: null,
           closed: false,
           closeEmitted: false,
           defaultEncoding: 'utf8',
           awaitDrainWriters: null,
           multiAwaitDrain: false,
           readingMore: false,
           dataEmitted: true,
           decoder: null,
           encoding: null,
           [Symbol(kPaused)]: false
         },
         _events: [Object: null prototype] {
           end: [Function: onReadableStreamEnd],
           free: [Function: onFree],
           close: [ [Function: onClose], [Function: socketCloseListener] ],
           timeout: [Function: onTimeout],
           agentRemove: [Function: onRemove],
           error: [Function: socketErrorListener],
           finish: [Function: bound onceWrapper] {
             listener: [Function: destroy]
           }
         },
         _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,
           buffered: [],
           bufferedIndex: 0,
           allBuffers: true,
           allNoop: true,
           pendingcb: 1,
           constructed: true,
           prefinished: false,
           errorEmitted: false,
           emitClose: false,
           autoDestroy: true,
           errored: null,
           closed: false,
           closeEmitted: false,
           [Symbol(kOnFinished)]: []
         },
         allowHalfOpen: false,
         _sockname: null,
         _pendingData: null,
         _pendingEncoding: '',
         server: null,
         _server: null,
         parser: null,
         _httpMessage: [Circular *1],
         [Symbol(async_id_symbol)]: 282,
         [Symbol(kHandle)]: TCP {
           reading: true,
           onconnection: null,
           [Symbol(owner_symbol)]: [Circular *2]
         },
         [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(RequestTimeout)]: undefined
       },
       httpVersionMajor: 1,
       httpVersionMinor: 1,
       httpVersion: '1.1',
       complete: true,
       rawHeaders: [
         'Content-Length',
         '89',
         'Content-Type',
         'application/json',
         'Vary',
         'Origin',
         'Date',
         'Thu, 03 Mar 2022 07:27:41 GMT',
         'Connection',
         'close'
       ],
       rawTrailers: [],
       aborted: false,
       upgrade: false,
       url: '',
       method: null,
       statusCode: 500,
       statusMessage: 'Internal Server Error',
       client: <ref *2> Socket {
         connecting: false,
         _hadError: false,
         _parent: null,
         _host: 'livekit',
         _readableState: ReadableState {
           objectMode: false,
           highWaterMark: 16384,
           buffer: BufferList { head: null, tail: null, length: 0 },
           length: 0,
           pipes: [],
           flowing: true,
           ended: false,
           endEmitted: false,
           reading: true,
           constructed: true,
           sync: false,
           needReadable: true,
           emittedReadable: false,
           readableListening: false,
           resumeScheduled: false,
           errorEmitted: false,
           emitClose: false,
           autoDestroy: true,
           destroyed: false,
           errored: null,
           closed: false,
           closeEmitted: false,
           defaultEncoding: 'utf8',
           awaitDrainWriters: null,
           multiAwaitDrain: false,
           readingMore: false,
           dataEmitted: true,
           decoder: null,
           encoding: null,
           [Symbol(kPaused)]: false
         },
         _events: [Object: null prototype] {
           end: [Function: onReadableStreamEnd],
           free: [Function: onFree],
           close: [ [Function: onClose], [Function: socketCloseListener] ],
           timeout: [Function: onTimeout],
           agentRemove: [Function: onRemove],
           error: [Function: socketErrorListener],
           finish: [Function: bound onceWrapper] {
             listener: [Function: destroy]
           }
         },
         _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,
           buffered: [],
           bufferedIndex: 0,
           allBuffers: true,
           allNoop: true,
           pendingcb: 1,
           constructed: true,
           prefinished: false,
           errorEmitted: false,
           emitClose: false,
           autoDestroy: true,
           errored: null,
           closed: false,
           closeEmitted: false,
           [Symbol(kOnFinished)]: []
         },
         allowHalfOpen: false,
         _sockname: null,
         _pendingData: null,
         _pendingEncoding: '',
         server: null,
         _server: null,
         parser: null,
         _httpMessage: [Circular *1],
         [Symbol(async_id_symbol)]: 282,
         [Symbol(kHandle)]: TCP {
           reading: true,
           onconnection: null,
           [Symbol(owner_symbol)]: [Circular *2]
         },
         [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(RequestTimeout)]: undefined
       },
       _consuming: false,
       _dumped: false,
       req: [Circular *1],
       responseUrl: 'http://livekit:7880/twirp/livekit.RecordingService/StartRecording',
       redirects: [],
       [Symbol(kCapture)]: false,
       [Symbol(kHeaders)]: {
         'content-length': '89',
         'content-type': 'application/json',
         vary: 'Origin',
         date: 'Thu, 03 Mar 2022 07:27:41 GMT',
         connection: 'close'
       },
       [Symbol(kHeadersCount)]: 10,
       [Symbol(kTrailers)]: null,
       [Symbol(kTrailersCount)]: 0,
       [Symbol(RequestTimeout)]: undefined
     },
     aborted: false,
     timeoutCb: null,
     upgradeOrConnect: false,
     parser: null,
     maxHeadersCount: null,
     reusedSocket: false,
     host: 'livekit',
     protocol: 'http:',
     _redirectable: Writable {
       _writableState: WritableState {
         objectMode: false,
         highWaterMark: 16384,
         finalCalled: false,
         needDrain: false,
         ending: false,
         ended: false,
         finished: false,
         destroyed: false,
         decodeStrings: true,
         defaultEncoding: 'utf8',
         length: 0,
         writing: false,
         corked: 0,
         sync: true,
         bufferProcessing: false,
         onwrite: [Function: bound onwrite],
         writecb: null,
         writelen: 0,
         afterWriteTickInfo: null,
         buffered: [],
         bufferedIndex: 0,
         allBuffers: true,
         allNoop: true,
         pendingcb: 0,
         constructed: true,
         prefinished: false,
         errorEmitted: false,
         emitClose: true,
         autoDestroy: true,
         errored: null,
         closed: false,
         closeEmitted: false,
         [Symbol(kOnFinished)]: []
       },
       _events: [Object: null prototype] {
         response: [Function: handleResponse],
         error: [Function: handleRequestError]
       },
       _eventsCount: 2,
       _maxListeners: undefined,
       _options: {
         maxRedirects: 21,
         maxBodyLength: 10485760,
         protocol: 'http:',
         path: '/twirp/livekit.RecordingService/StartRecording',
         method: 'POST',
         headers: {
           Accept: 'application/json, text/plain, */*',
           'Content-Type': 'application/json',
           Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0',
           'User-Agent': 'axios/0.21.4',
           'Content-Length': 122
         },
         agent: undefined,
         agents: { http: undefined, https: undefined },
         auth: undefined,
         hostname: 'livekit',
         port: '7880',
         nativeProtocols: {
           'http:': {
             _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],
             validateHeaderName: [Function: __node_internal_],
             validateHeaderValue: [Function: __node_internal_],
             get: [Function: get],
             request: [Function: request],
             maxHeaderSize: [Getter],
             globalAgent: [Getter/Setter]
           },
           'https:': {
             Agent: [Function: Agent],
             globalAgent: [Agent],
             Server: [Function: Server],
             createServer: [Function: createServer],
             get: [Function: get],
             request: [Function: request]
           }
         },
         pathname: '/twirp/livekit.RecordingService/StartRecording'
       },
       _ended: true,
       _ending: true,
       _redirectCount: 0,
       _redirects: [],
       _requestBodyLength: 122,
       _requestBodyBuffers: [],
       _onNativeResponse: [Function (anonymous)],
       _currentRequest: [Circular *1],
       _currentUrl: 'http://livekit:7880/twirp/livekit.RecordingService/StartRecording',
       [Symbol(kCapture)]: false
     },
     [Symbol(kCapture)]: false,
     [Symbol(kNeedDrain)]: false,
     [Symbol(corked)]: 0,
     [Symbol(kOutHeaders)]: [Object: null prototype] {
       accept: [ 'Accept', 'application/json, text/plain, */*' ],
       'content-type': [ 'Content-Type', 'application/json' ],
       authorization: [
         'Authorization',
         'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0'
       ],
       'user-agent': [ 'User-Agent', 'axios/0.21.4' ],
       'content-length': [ 'Content-Length', 122 ],
       host: [ 'Host', 'livekit:7880' ]
     }
   },
   response: {
     status: 500,
     statusText: 'Internal Server Error',
     headers: {
       'content-length': '89',
       'content-type': 'application/json',
       vary: 'Origin',
       date: 'Thu, 03 Mar 2022 07:27:41 GMT',
       connection: 'close'
     },
     config: {
       url: '/twirp/livekit.RecordingService/StartRecording',
       method: 'post',
       data: '{"template":{"layout":"grid-dark","roomName":"NT0C5SD2HCWS5KO8SHJEO","baseUrl":""},"filepath":"NT0C5SD2HCWS5KO8SHJEO.mp4"}',
       headers: {
         Accept: 'application/json, text/plain, */*',
         'Content-Type': 'application/json',
         Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0',
         'User-Agent': 'axios/0.21.4',
         'Content-Length': 122
       },
       baseURL: 'http://livekit:7880',
       transformRequest: [ [Function: transformRequest] ],
       transformResponse: [ [Function: transformResponse] ],
       timeout: 0,
       adapter: [Function: httpAdapter],
       xsrfCookieName: 'XSRF-TOKEN',
       xsrfHeaderName: 'X-XSRF-TOKEN',
       maxContentLength: -1,
       maxBodyLength: -1,
       validateStatus: [Function: validateStatus],
       transitional: {
         silentJSONParsing: true,
         forcedJSONParsing: true,
         clarifyTimeoutError: false
       }
     },
     request: <ref *1> ClientRequest {
       _events: [Object: null prototype] {
         abort: [Function (anonymous)],
         aborted: [Function (anonymous)],
         connect: [Function (anonymous)],
         error: [Function (anonymous)],
         socket: [Function (anonymous)],
         timeout: [Function (anonymous)],
         prefinish: [Function: requestOnPrefinish]
       },
       _eventsCount: 7,
       _maxListeners: undefined,
       outputData: [],
       outputSize: 0,
       writable: true,
       destroyed: false,
       _last: true,
       chunkedEncoding: false,
       shouldKeepAlive: false,
       maxRequestsOnConnectionReached: false,
       _defaultKeepAlive: true,
       useChunkedEncodingByDefault: true,
       sendDate: false,
       _removedConnection: false,
       _removedContLen: false,
       _removedTE: false,
       _contentLength: null,
       _hasBody: true,
       _trailer: '',
       finished: true,
       _headerSent: true,
       _closed: false,
       socket: <ref *2> Socket {
         connecting: false,
         _hadError: false,
         _parent: null,
         _host: 'livekit',
         _readableState: ReadableState {
           objectMode: false,
           highWaterMark: 16384,
           buffer: BufferList { head: null, tail: null, length: 0 },
           length: 0,
           pipes: [],
           flowing: true,
           ended: false,
           endEmitted: false,
           reading: true,
           constructed: true,
           sync: false,
           needReadable: true,
           emittedReadable: false,
           readableListening: false,
           resumeScheduled: false,
           errorEmitted: false,
           emitClose: false,
           autoDestroy: true,
           destroyed: false,
           errored: null,
           closed: false,
           closeEmitted: false,
           defaultEncoding: 'utf8',
           awaitDrainWriters: null,
           multiAwaitDrain: false,
           readingMore: false,
           dataEmitted: true,
           decoder: null,
           encoding: null,
           [Symbol(kPaused)]: false
         },
         _events: [Object: null prototype] {
           end: [Function: onReadableStreamEnd],
           free: [Function: onFree],
           close: [ [Function: onClose], [Function: socketCloseListener] ],
           timeout: [Function: onTimeout],
           agentRemove: [Function: onRemove],
           error: [Function: socketErrorListener],
           finish: [Function: bound onceWrapper] {
             listener: [Function: destroy]
           }
         },
         _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,
           buffered: [],
           bufferedIndex: 0,
           allBuffers: true,
           allNoop: true,
           pendingcb: 1,
           constructed: true,
           prefinished: false,
           errorEmitted: false,
           emitClose: false,
           autoDestroy: true,
           errored: null,
           closed: false,
           closeEmitted: false,
           [Symbol(kOnFinished)]: []
         },
         allowHalfOpen: false,
         _sockname: null,
         _pendingData: null,
         _pendingEncoding: '',
         server: null,
         _server: null,
         parser: null,
         _httpMessage: [Circular *1],
         [Symbol(async_id_symbol)]: 282,
         [Symbol(kHandle)]: TCP {
           reading: true,
           onconnection: null,
           [Symbol(owner_symbol)]: [Circular *2]
         },
         [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(RequestTimeout)]: undefined
       },
       _header: 'POST /twirp/livekit.RecordingService/StartRecording HTTP/1.1\r\n' +
         'Accept: application/json, text/plain, */*\r\n' +
         'Content-Type: application/json\r\n' +
         'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0\r\n' +
         'User-Agent: axios/0.21.4\r\n' +
         'Content-Length: 122\r\n' +
         'Host: livekit:7880\r\n' +
         'Connection: close\r\n' +
         '\r\n',
       _keepAliveTimeout: 0,
       _onPendingData: [Function: nop],
       agent: Agent {
         _events: [Object: null prototype] {
           free: [Function (anonymous)],
           newListener: [Function: maybeEnableKeylog]
         },
         _eventsCount: 2,
         _maxListeners: undefined,
         defaultPort: 80,
         protocol: 'http:',
         options: [Object: null prototype] { path: null },
         requests: [Object: null prototype] {},
         sockets: [Object: null prototype] { 'livekit:7880:': [ [Socket] ] },
         freeSockets: [Object: null prototype] {},
         keepAliveMsecs: 1000,
         keepAlive: false,
         maxSockets: Infinity,
         maxFreeSockets: 256,
         scheduling: 'lifo',
         maxTotalSockets: Infinity,
         totalSocketCount: 1,
         [Symbol(kCapture)]: false
       },
       socketPath: undefined,
       method: 'POST',
       maxHeaderSize: undefined,
       insecureHTTPParser: undefined,
       path: '/twirp/livekit.RecordingService/StartRecording',
       _ended: true,
       res: IncomingMessage {
         _readableState: ReadableState {
           objectMode: false,
           highWaterMark: 16384,
           buffer: BufferList { head: null, tail: null, length: 0 },
           length: 0,
           pipes: [],
           flowing: true,
           ended: true,
           endEmitted: true,
           reading: false,
           constructed: true,
           sync: true,
           needReadable: false,
           emittedReadable: false,
           readableListening: false,
           resumeScheduled: false,
           errorEmitted: false,
           emitClose: true,
           autoDestroy: true,
           destroyed: true,
           errored: null,
           closed: true,
           closeEmitted: true,
           defaultEncoding: 'utf8',
           awaitDrainWriters: null,
           multiAwaitDrain: false,
           readingMore: true,
           dataEmitted: true,
           decoder: null,
           encoding: null,
           [Symbol(kPaused)]: false
         },
         _events: [Object: null prototype] {
           end: [ [Function: responseOnEnd], [Function: handleStreamEnd] ],
           data: [Function: handleStreamData],
           error: [Function: handleStreamError]
         },
         _eventsCount: 3,
         _maxListeners: undefined,
         socket: <ref *2> Socket {
           connecting: false,
           _hadError: false,
           _parent: null,
           _host: 'livekit',
           _readableState: ReadableState {
             objectMode: false,
             highWaterMark: 16384,
             buffer: [BufferList],
             length: 0,
             pipes: [],
             flowing: true,
             ended: false,
             endEmitted: false,
             reading: true,
             constructed: true,
             sync: false,
             needReadable: true,
             emittedReadable: false,
             readableListening: false,
             resumeScheduled: false,
             errorEmitted: false,
             emitClose: false,
             autoDestroy: true,
             destroyed: false,
             errored: null,
             closed: false,
             closeEmitted: false,
             defaultEncoding: 'utf8',
             awaitDrainWriters: null,
             multiAwaitDrain: false,
             readingMore: false,
             dataEmitted: true,
             decoder: null,
             encoding: null,
             [Symbol(kPaused)]: false
           },
           _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,
             buffered: [],
             bufferedIndex: 0,
             allBuffers: true,
             allNoop: true,
             pendingcb: 1,
             constructed: true,
             prefinished: false,
             errorEmitted: false,
             emitClose: false,
             autoDestroy: true,
             errored: null,
             closed: false,
             closeEmitted: false,
             [Symbol(kOnFinished)]: []
           },
           allowHalfOpen: false,
           _sockname: null,
           _pendingData: null,
           _pendingEncoding: '',
           server: null,
           _server: null,
           parser: null,
           _httpMessage: [Circular *1],
           [Symbol(async_id_symbol)]: 282,
           [Symbol(kHandle)]: TCP {
             reading: true,
             onconnection: null,
             [Symbol(owner_symbol)]: [Circular *2]
           },
           [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(RequestTimeout)]: undefined
         },
         httpVersionMajor: 1,
         httpVersionMinor: 1,
         httpVersion: '1.1',
         complete: true,
         rawHeaders: [
           'Content-Length',
           '89',
           'Content-Type',
           'application/json',
           'Vary',
           'Origin',
           'Date',
           'Thu, 03 Mar 2022 07:27:41 GMT',
           'Connection',
           'close'
         ],
         rawTrailers: [],
         aborted: false,
         upgrade: false,
         url: '',
         method: null,
         statusCode: 500,
         statusMessage: 'Internal Server Error',
         client: <ref *2> Socket {
           connecting: false,
           _hadError: false,
           _parent: null,
           _host: 'livekit',
           _readableState: ReadableState {
             objectMode: false,
             highWaterMark: 16384,
             buffer: [BufferList],
             length: 0,
             pipes: [],
             flowing: true,
             ended: false,
             endEmitted: false,
             reading: true,
             constructed: true,
             sync: false,
             needReadable: true,
             emittedReadable: false,
             readableListening: false,
             resumeScheduled: false,
             errorEmitted: false,
             emitClose: false,
             autoDestroy: true,
             destroyed: false,
             errored: null,
             closed: false,
             closeEmitted: false,
             defaultEncoding: 'utf8',
             awaitDrainWriters: null,
             multiAwaitDrain: false,
             readingMore: false,
             dataEmitted: true,
             decoder: null,
             encoding: null,
             [Symbol(kPaused)]: false
           },
           _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,
             buffered: [],
             bufferedIndex: 0,
             allBuffers: true,
             allNoop: true,
             pendingcb: 1,
             constructed: true,
             prefinished: false,
             errorEmitted: false,
             emitClose: false,
             autoDestroy: true,
             errored: null,
             closed: false,
             closeEmitted: false,
             [Symbol(kOnFinished)]: []
           },
           allowHalfOpen: false,
           _sockname: null,
           _pendingData: null,
           _pendingEncoding: '',
           server: null,
           _server: null,
           parser: null,
           _httpMessage: [Circular *1],
           [Symbol(async_id_symbol)]: 282,
           [Symbol(kHandle)]: TCP {
             reading: true,
             onconnection: null,
             [Symbol(owner_symbol)]: [Circular *2]
           },
           [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(RequestTimeout)]: undefined
         },
         _consuming: false,
         _dumped: false,
         req: [Circular *1],
         responseUrl: 'http://livekit:7880/twirp/livekit.RecordingService/StartRecording',
         redirects: [],
         [Symbol(kCapture)]: false,
         [Symbol(kHeaders)]: {
           'content-length': '89',
           'content-type': 'application/json',
           vary: 'Origin',
           date: 'Thu, 03 Mar 2022 07:27:41 GMT',
           connection: 'close'
         },
         [Symbol(kHeadersCount)]: 10,
         [Symbol(kTrailers)]: null,
         [Symbol(kTrailersCount)]: 0,
         [Symbol(RequestTimeout)]: undefined
       },
       aborted: false,
       timeoutCb: null,
       upgradeOrConnect: false,
       parser: null,
       maxHeadersCount: null,
       reusedSocket: false,
       host: 'livekit',
       protocol: 'http:',
       _redirectable: Writable {
         _writableState: WritableState {
           objectMode: false,
           highWaterMark: 16384,
           finalCalled: false,
           needDrain: false,
           ending: false,
           ended: false,
           finished: false,
           destroyed: false,
           decodeStrings: true,
           defaultEncoding: 'utf8',
           length: 0,
           writing: false,
           corked: 0,
           sync: true,
           bufferProcessing: false,
           onwrite: [Function: bound onwrite],
           writecb: null,
           writelen: 0,
           afterWriteTickInfo: null,
           buffered: [],
           bufferedIndex: 0,
           allBuffers: true,
           allNoop: true,
           pendingcb: 0,
           constructed: true,
           prefinished: false,
           errorEmitted: false,
           emitClose: true,
           autoDestroy: true,
           errored: null,
           closed: false,
           closeEmitted: false,
           [Symbol(kOnFinished)]: []
         },
         _events: [Object: null prototype] {
           response: [Function: handleResponse],
           error: [Function: handleRequestError]
         },
         _eventsCount: 2,
         _maxListeners: undefined,
         _options: {
           maxRedirects: 21,
           maxBodyLength: 10485760,
           protocol: 'http:',
           path: '/twirp/livekit.RecordingService/StartRecording',
           method: 'POST',
           headers: {
             Accept: 'application/json, text/plain, */*',
             'Content-Type': 'application/json',
             Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0',
             'User-Agent': 'axios/0.21.4',
             'Content-Length': 122
           },
           agent: undefined,
           agents: { http: undefined, https: undefined },
           auth: undefined,
           hostname: 'livekit',
           port: '7880',
           nativeProtocols: { 'http:': [Object], 'https:': [Object] },
           pathname: '/twirp/livekit.RecordingService/StartRecording'
         },
         _ended: true,
         _ending: true,
         _redirectCount: 0,
         _redirects: [],
         _requestBodyLength: 122,
         _requestBodyBuffers: [],
         _onNativeResponse: [Function (anonymous)],
         _currentRequest: [Circular *1],
         _currentUrl: 'http://livekit:7880/twirp/livekit.RecordingService/StartRecording',
         [Symbol(kCapture)]: false
       },
       [Symbol(kCapture)]: false,
       [Symbol(kNeedDrain)]: false,
       [Symbol(corked)]: 0,
       [Symbol(kOutHeaders)]: [Object: null prototype] {
         accept: [ 'Accept', 'application/json, text/plain, */*' ],
         'content-type': [ 'Content-Type', 'application/json' ],
         authorization: [
           'Authorization',
           'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2aWRlbyI6eyJyb29tUmVjb3JkIjp0cnVlfSwiaWF0IjoxNjQ2MjkyNDU4LCJuYmYiOjE2NDYyOTI0NTgsImV4cCI6MTY0NjI5MzA1OCwiaXNzIjoiQVBJRU5XRnRSYkxWY2NrIn0.eBFy0hg4Ss18kR8OWWcImdpAo1jeVeRXxa4DsGTH6I0'
         ],
         'user-agent': [ 'User-Agent', 'axios/0.21.4' ],
         'content-length': [ 'Content-Length', 122 ],
         host: [ 'Host', 'livekit:7880' ]
       }
     },
     data: {
       code: 'internal',
       msg: 'no recorders available',
       meta: { cause: '*errors.errorString' }
     }
   },
   isAxiosError: true,
   toJSON: [Function: toJSON]
 }

@alex-bluetrain
Copy link
Author

also note that RecordingServiceClient is not being exported correctly for commonJS, I had to use those ugly require's

@davidzhao
Copy link
Member

thanks for the report @alex-bluetrain. we'll look into it in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants