cube icon indicating copy to clipboard operation
cube copied to clipboard

Error connecting to mongodb

Open ghostaccount737 opened this issue 7 years ago • 11 comments

Describe the bug Error connecting mongodb and I find it to be a duplicate of #24 but here its not postgres and I am not sure which one fixes the error

To Reproduce

- Fetching DB schema

Cube.js Error ---------------------------------------

Error: connect ECONNREFUSED 127.0.0.1:5000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)

Any suggestions ?

ghostaccount737 avatar Jun 18 '19 13:06 ghostaccount737

Hey @PVinay737 ! On what port are you running your mongo BI server? Usually the port is 3307. Please see https://cube.dev/blog/building-mongodb-dashboard-using-node.js for more info.

paveltiunov avatar Jun 18 '19 19:06 paveltiunov

Still the same error persists with port 3307 as well

ghostaccount737 avatar Jun 19 '19 05:06 ghostaccount737

@PVinay737 Are you running mongo BI server? If yes, could you please provide its logs?

paveltiunov avatar Jun 19 '19 17:06 paveltiunov

Working !

The issue arises when one does not start mongo BI server

The succesful log should end with something like this

2019-06-19T23:14:06.389+0530 I NETWORK    [conn1] connection accepted from 127.0.0.1:56754 #1 (1 connection now open)
2019-06-19T23:14:06.631+0530 I NETWORK    [conn1] end connection 127.0.0.1:56754 (0 connections now open)

ghostaccount737 avatar Jun 19 '19 17:06 ghostaccount737

Hi @paveltiunov, I am trying to get this running and stuck with an error.

Error: connect ETIMEDOUT at Connection._handleTimeoutError (/Users/devmachine/apps/cube/mongo-tutorial/node_modules/mysql2/lib/connection.js:178:17) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7)

.env file configuration is here

CUBEJS_DB_HOST=localhost CUBEJS_DB_NAME=test CUBEJS_DB_PORT=27017 CUBEJS_DB_TYPE=mongobi CUBEJS_API_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am trying to run with MongoDB Atlas then after tried with localhost setup, getting same error.

dharmdip avatar Jun 17 '20 12:06 dharmdip

Hi @paveltiunov,

it's working now, did't configure MongoBI with path and causing the issue.

dharmdip avatar Jun 18 '20 03:06 dharmdip

Hi @paveltiunov paveltiunov, same error for me:

Error: connect ECONNREFUSED 17x.xx.xx.13:3307
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16)

I've tried different combinations for .env configuration:

CUBEJS_DB_HOST=17x.xx.xx.13
CUBEJS_DB_NAME=xxxxAPI
CUBEJS_DB_USER=root
CUBEJS_DB_PASS=xxxx
CUBEJS_DB_PORT=3307
CUBEJS_DB_TYPE=mongobi
CUBEJS_API_SECRET=xxx

The BI connector seems to work fine :

image

Matar91 avatar Jul 21 '20 15:07 Matar91

@Matar91 Your MongoBI is listening on loopback's 127.0.0.1 address and you're trying to connect using real network interface address.

paveltiunov avatar Jul 23 '20 06:07 paveltiunov

@Matar91 Your MongoBI is listening on loopback's 127.0.0.1 address and you're trying to connect using real network interface address.

Thanks @paveltiunov i managed to solve that problem. The only problem left with handshake, happens once Cube Js connects with BIconnector:

image

I am using SSL certificate as you suggested here https://stackoverflow.com/questions/58868085/cube-js-error-ssl-is-required-when-using-cleartext-authentication-using-mongod

Matar91 avatar Aug 28 '20 16:08 Matar91

@Matar91 Your MongoBI is listening on loopback's 127.0.0.1 address and you're trying to connect using real network interface address.

Thanks @paveltiunov i managed to solve that problem. The only problem left with handshake, happens once Cube Js connects with BIconnector:

image

I am using SSL certificate as you suggested here https://stackoverflow.com/questions/58868085/cube-js-error-ssl-is-required-when-using-cleartext-authentication-using-mongod

Solved, had to add this in cube.js .env file:

CUBEJS_DB_SSL=true CUBEJS_DB_SSL_REJECT_UNAUTHORIZED=false

Matar91 avatar Aug 31 '20 09:08 Matar91

I got hit with the ECONNREFUSED error for MongoDB because I was running cube js locally on a mac in a Docker container and trying to connect to mongodb bi locally at 127.0.0.1. Needed to use host.docker.internal - https://docs.docker.com/docker-for-mac/networking/

FiveOFive avatar May 25 '21 20:05 FiveOFive