owt-server icon indicating copy to clipboard operation
owt-server copied to clipboard

MongooseError with Atlas Cloud

Open Chandramouli-P opened this issue 3 years ago • 17 comments

Hello,

Good evening. I am trying to use MongoDB in cloud (Atlas) from OWT framework. I checked and everything is good from Atlas side. After initializing and starting OWT agents, it is connecting to Atlas and creating the "owtdb" database successfully with "infos, and services" collections. **But, It is not creating "keys, and rooms" collections and throwing the below error:

MongooseError: Operation keys.findOneAndUpdate() buffering timed out after 10000ms**

I am giving the URL schema as below in the agents file:

[mongo] dataBaseURL = "mongodb+srv://DatabaseUserName:[email protected]/owtdb?retryWrites=true&w=majority"

Please suggest me how to solve this issue?

Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 21 '22 13:04 Chandramouli-P

Hi, "owtdb" is created during intialization. Your error indicated that agent cannot connect to mongodb. Please check your mongodb configuration (maybe it restricted connect IP) and dataBaseURL. You could also use "mongo" command line to test connectivity in your environment.

starwarfan avatar Apr 22 '22 03:04 starwarfan

Hello,

Thank you for your reply. As I mentioned, everything is good from MongoDB (Atlas) side including allowed IPs, privileges, etc. I am able to connect to the database using "mongo" command line.

As "owtdb" is creating during initialization means, there is no issue from connectivity point of view. Do I need to change anything in NodeJS source code of agents (As per the Google to resolve the error)?

Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 22 '22 03:04 Chandramouli-P

Which version and which log produced that error?

starwarfan avatar Apr 22 '22 05:04 starwarfan

Hello,

Thank you for your reply. Please find the below details:

Intel OWT version: v.5.0

Please see the log here: https://controlc.com/69b1ab3b

Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 22 '22 08:04 Chandramouli-P

Hello,

Good evening and any help would be appreciated. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 25 '22 10:04 Chandramouli-P

Is your DB URL setting of management-api same as that during intialization?

starwarfan avatar Apr 26 '22 05:04 starwarfan

Hello,

Good evening and thank you for your reply. I had given the same DB URL in "management_api/init.sh" file and just double checked too.

Also, as we are using MongoDB in Atlas cloud, I commented out all the "${ROOT}/bin/init-mongodb.sh" lines in "bin/init-all.sh" file.

Please let me know, if you need any further information.

Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 26 '22 09:04 Chandramouli-P

Hello,

Good afternoon and any update would be appreciated. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 29 '22 08:04 Chandramouli-P

Hi, The initdb.js uses raw MongoClient to connect DB, and the url will be processed before passing to the lib. And the agent may also process URL before connecting, refer to data_access/index.js. You could edit that file to confirm the URL. (https://github.com/open-webrtc-toolkit/owt-server/blob/v5.0/source/data_access/index.js#L28)

starwarfan avatar Apr 29 '22 08:04 starwarfan

Hello,

Thank you for your reply.

My database URL is:
"mongodb+srv://DatabaseUserName:[email protected]/owtdb?retryWrites=true&w=majority"

If I understand correctly, I need to change the below line in index.js from

mongoose.connect('mongodb://' + databaseUrl, connectOption)

to

mongoose.connect('mongodb+srv://' + databaseUrl, connectOption)

and build the SDK, and then give the database URL in configuration files as:

[mongo] dataBaseURL = "DatabaseUserName:[email protected]/owtdb?retryWrites=true&w=majority"

Am I right? Please correct me, If I am wrong.

Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 29 '22 10:04 Chandramouli-P

Hello,

As I am using the downloaded version from Intel CS for WebRTC website, I changed the below line in Release-v5.0/management_api/data_access/index.js file:

Changed mongoose.connect('mongodb://' to mongoose.connect("mongodb+srv://"

and then, I had given database URL as below in the following configuration files:

Release-v5.0/management_api/management_api.toml: [mongo] dataBaseURL = "DatabaseUserName:[email protected]/owtdb?retryWrites=true&w=majority"

Release-v5.0/management_api/init.sh: DB_URL='DatabaseUserName:[email protected]/owtdb?retryWrites=true&w=majority'

After executing Release-v5.0/bin/init.all.sh, I am getting the following error on console:

ubuntu@ip-172-31-29-210:~/Release-v5.0$ sudo bin/init-all.sh Initializing... Rabbitmq-server already running Initializing ManagementAPIServer configuration... /home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/utils.js:671 throw error; ^

MongoServerSelectionError: getaddrinfo ENOTFOUND AtlasClusterName.xyz.mongodb.net AtlasClusterName.xyz.mongodb.net:27017 at Timeout.waitQueueMember.timer.setTimeout [as _onTimeout] (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/core/sdam/topology.js:438:30) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) Emitted 'error' event at: at /home/ubuntu/Release-v5.0/management_api/node_modules/mongojs/lib/database.js:36:16 at /home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/utils.js:668:9 at err (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/mongo_client.js:225:23) at connectCallback (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/operations/connect.js:366:5) at topology.connect.err (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/operations/connect.js:599:14) at connectHandler (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/core/sdam/topology.js:285:11) at Object.selectServer [as callback] (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/core/sdam/topology.js:668:9) at Timeout.waitQueueMember.timer.setTimeout [as _onTimeout] (/home/ubuntu/Release-v5.0/management_api/node_modules/mongodb/lib/core/sdam/topology.js:443:25) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) Hardware acceleration disbled Update RabbitMQ/MongoDB Account? [No/yes]ubuntu@ip-172-31-29-210:~/Release-v5.0$

Hence, request you to help us to resolve the issue. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 29 '22 11:04 Chandramouli-P

Hello,

Good afternoon and any update would be appreciated. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar Apr 30 '22 08:04 Chandramouli-P

Hello,

Good evening and any update would be appreciated. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar May 02 '22 13:05 Chandramouli-P

Hello,

Good evening and any update would be appreciated. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar May 04 '22 09:05 Chandramouli-P

You said your initialization was successful before. So you do not need change code for initialization in management-api.

starwarfan avatar May 05 '22 01:05 starwarfan

Hello,

Good evening and thank you for your reply. As you suggested, I reverted back the URL and source code in management_api. When I execute "start-all.sh" command, I am getting the below errors and please find the log of "management_api" at the below link:

https://controlc.com/ee5e386f

We look forward to your reply and help. Thank you.

Best Regards, Chandramouli.

Chandramouli-P avatar May 05 '22 12:05 Chandramouli-P

Hello, If your previous initialization is successful, I think you need keep only the change for connecting. As I mentioned before, the initialization code is in management_api/initdb.js, you need update this file too if you want to change initialization url.

starwarfan avatar May 06 '22 01:05 starwarfan