OpenVidu / openvidu-tutorials

OpenVidu tutorials to get started
http://openvidu.io/tutorials
Apache License 2.0
228 stars 255 forks source link

Error: [object Object] at /usr/src/app/node_modules/openvidu-node-client/lib/Session.js:471:28 #145

Closed ajmc90 closed 3 years ago

ajmc90 commented 3 years ago

I'm having this issue "Error: [object Object] at /usr/src/app/node_modules/openvidu-node-client/lib/Session.js:471:28"

I have access to this url: https://localhost:4443/ and is working

This is my docker-compose.yml file:

version: '3'

services: kurento: image: kurento/kurento-media-server network_mode: bridge expose:

This is my Dockerfile

FROM node:15.5.0 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install RUN npm install pm2 -g COPY . . EXPOSE 5000 CMD [ "node", "--trace-warnings" ,"./server.js", "https://localhost:4443", "MY_SECRET" ]`

And this is the error that I'm getting:

(node:1) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.

at getAllowUnauthorized (node:internal/options:21:13)

at Object.connect (node:_tls_wrap:1581:29)

at Agent.createConnection (node:https:130:22)

at Agent.createSocket (node:_http_agent:323:26)

at Agent.addRequest (node:_http_agent:274:10)

at new ClientRequest (node:_http_client:314:16)

at Object.request (node:https:326:10)

at RedirectableRequest._performRequest (/usr/src/app/node_modules/follow-redirects/index.js:241:24)

at new RedirectableRequest (/usr/src/app/node_modules/follow-redirects/index.js:60:8)

at Object.request (/usr/src/app/node_modules/follow-redirects/index.js:437:14)

<ref *2> 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,

},

_events: [Object: null prototype] {

response: [Function: handleResponse],

error: [Function: handleRequestError]

},

_eventsCount: 2,

_maxListeners: undefined,

_options: {

maxRedirects: 21,

maxBodyLength: 10485760,

protocol: 'https:',

path: '/openvidu/api/sessions',

method: 'POST',

headers: {

Accept: 'application/json, text/plain, /',

'Content-Type': 'application/json',

Authorization: 'Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU',

'User-Agent': 'axios/0.21.0',

'Content-Length': 160

},

agent: undefined,

agents: { http: undefined, https: undefined },

auth: undefined,

hostname: 'localhost',

port: '4443',

nativeProtocols: { 'http:': [Object], 'https:': [Object] },

pathname: '/openvidu/api/sessions'

},

_ended: false,

_ending: true,

_redirectCount: 0,

_redirects: [],

_requestBodyLength: 160,

_requestBodyBuffers: [

{

data: <Buffer 7b 22 6d 65 64 69 61 4d 6f 64 65 22 3a 22 52 4f 55 54 45 44 22 2c 22 72 65 63 6f 72 64 69 6e 67 4d 6f 64 65 22 3a 22 4d 41 4e 55 41 4c 22 2c 22 64 65 ... 110 more bytes>,

encoding: undefined

}

],

_onNativeResponse: [Function (anonymous)],

_currentRequest: <ref *1> ClientRequest {

_events: [Object: null prototype] {

response: [Function],

socket: [Function (anonymous)],

abort: [Function (anonymous)],

aborted: [Function (anonymous)],

connect: [Function (anonymous)],

error: [Function (anonymous)],

timeout: [Function (anonymous)]

},

_eventsCount: 7,

_maxListeners: undefined,

outputData: [],

outputSize: 0,

writable: true,

destroyed: false,

_last: true,

chunkedEncoding: false,

shouldKeepAlive: false,

_defaultKeepAlive: true,

useChunkedEncodingByDefault: true,

sendDate: false,

_removedConnection: false,

_removedContLen: false,

_removedTE: false,

_contentLength: null,

_hasBody: true,

_trailer: '',

finished: false,

_headerSent: true,

_closed: false,

socket: TLSSocket {

_tlsOptions: [Object],

_secureEstablished: false,

_securePending: false,

_newSessionPending: false,

_controlReleased: true,

secureConnecting: true,

_SNICallback: null,

servername: null,

alpnProtocol: null,

authorized: false,

authorizationError: null,

encrypted: true,

_events: [Object: null prototype],

_eventsCount: 11,

connecting: false,

_hadError: true,

_parent: null,

_host: 'localhost',

_readableState: [ReadableState],

_maxListeners: undefined,

_writableState: [WritableState],

allowHalfOpen: false,

_sockname: null,

_pendingData: [Array],

_pendingEncoding: '',

server: undefined,

_server: null,

ssl: null,

_requestCert: true,

_rejectUnauthorized: false,

parser: null,

_httpMessage: [Circular *1],

},

_header: 'POST /openvidu/api/sessions HTTP/1.1\r\n' +

'Accept: application/json, text/plain, /\r\n' +

'Content-Type: application/json\r\n' +

'Authorization: Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU\r\n' +

'User-Agent: axios/0.21.0\r\n' +

'Content-Length: 160\r\n' +

'Host: localhost:4443\r\n' +

'Connection: close\r\n' +

'\r\n',

_keepAliveTimeout: 0,

_onPendingData: [Function: noopPendingOutput],

agent: Agent {

_events: [Object: null prototype],

_eventsCount: 2,

_maxListeners: undefined,

defaultPort: 443,

protocol: 'https:',

options: [Object],

requests: {},

sockets: [Object],

freeSockets: {},

keepAliveMsecs: 1000,

keepAlive: false,

maxSockets: Infinity,

maxFreeSockets: 256,

scheduling: 'fifo',

maxTotalSockets: Infinity,

totalSocketCount: 1,

maxCachedSessions: 100,

_sessionCache: [Object],

},

socketPath: undefined,

method: 'POST',

maxHeaderSize: undefined,

insecureHTTPParser: undefined,

path: '/openvidu/api/sessions',

_ended: false,

res: null,

aborted: false,

timeoutCb: null,

upgradeOrConnect: false,

parser: null,

maxHeadersCount: null,

reusedSocket: false,

host: 'localhost',

protocol: 'https:',

_redirectable: [Circular *2],

[Symbol(kOutHeaders)]: [Object: null prototype] {

accept: [Array],

'content-type': [Array],

authorization: [Array],

'user-agent': [Array],

'content-length': [Array],

host: [Array]

}

},

_currentUrl: 'https://localhost:4443/openvidu/api/sessions',

}

Error: [object Object]

at /usr/src/app/node_modules/openvidu-node-client/lib/Session.js:471:28

at processTicksAndRejections (node:internal/process/task_queues:93:5)

Thank you for your help.

micaelgallego commented 3 years ago

openvidu-server-kms docker image is designed for local development.

If you want to deploy OpenVidu to be used for production, please follow these instructions:

https://docs.openvidu.io/en/2.16.0/deployment/deploying-on-premises/

Regards