0

I’m running the database with mongoDB and i have converted it into Query data with the help of mongosqld(mongoDB BI connector). And i want to fetch the data in cube server but whenever i do this cube server throws me the error which is in the below image.

Mongosqld.config file

  bindIp: "127.0.0.1"
  port: 3307
  ssl:
    mode: "allowSSL"
    allowInvalidCertificates: false
    PEMKeyFile: "/mongo.pem"
    CAFile: "/certificate.pem"
    minimumTLSVersion: TLS1_1

mongodb:
  net:
    uri: "mongodb://localhost:27017"
    ssl:
      enabled: false
    auth:
      username: "kp"
      password: "kp@123"
      source: "admin"

security:
  enabled: true
  defaultMechanism: "SCRAM-SHA-256"
  defaultSource: "admin"

processManagement:
  service:
    name: "mongosql"
    displayName: "MongoSQL Service"
    description: "MongoSQL accesses MongoDB data with SQL"

CUBE env file

# Cube.js environment variables: https://cube.dev/docs/reference/environment-variables
CUBEJS_DB_TYPE=mongobi
CUBEJS_API_SECRET=9c7a834d9be0cd2fb4e7b86a88a2bd1368ffbc614dcf8fa8f836933b00d00c6916fa83b074c66a2b26579266edc93e0e1990b1271f6214ee799dc08b05b6a097
CUBEJS_EXTERNAL_DEFAULT=true
CUBEJS_SCHEDULED_REFRESH_DEFAULT=true
CUBEJS_WEB_SOCKETS=true
CUBEJS_DB_HOST=127.0.0.1
CUBEJS_DB_NAME=(database name)
CUBEJS_DB_USER=kp
CUBEJS_DB_PASSWORD=kp@123
CUBEJS_DB_PORT=3307
CUBEJS_DEV_MODE=true
CUBEJS_REFRESH_WORKER=true
# port=4242
# NODE_ENV=production
CUBEJS_DB_SSL=true 
#CUBEJS_DB_SSL_CA=<SSL_CA>
#CUBEJS_DB_SSL_CERT=<SSL_CERT>
#CUBEJS_DB_SSL_CIPHERS=<SSL_CIPHERS>
#CUBEJS_DB_SSL_PASSPHRASE=<SSL_PASSPHRASE>
CUBEJS_DB_SSL_REJECT_UNAUTHORIZED=false

Roles provided to user kp

Successfully added user: 
{
   "user" : "kp",
   "roles" : [
     {
       "role" :"userAdminAnyDatabase",
       "db" : "admin"
     },
     {
       "role" :"readWriteAnyDatabase",
       "db" : "admin"
     },
     {
       "role" :"dbAdminAnyDatabase",
       "db" : "admin"
     }
  ]
} 

Error is this:

2022-12-28T14:06:22.244+0530 I NETWORK    [conn5] connection accepted from 127.0.0.1:63039 #5 (1 connection now open)                                                                   
2022-12-28T14:06:22.277+0530 E NETWORK    [conn5] handshake error: unable to authenticate conversation 0: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-256": (AuthenticationFailed) Authentication failed.
2022-12-28T14:06:22.279+0530 I NETWORK    [conn5] end connection 127.0.0.1:63039 (0 connections now open) 

Error in cube server

Error while loading DB schema
Error: Access denied for user 'kp' at PromiseConnection.connect (E:\mongobiCube\node_modules\mysql2\promise.js:171:22) at Object.create (E:\mongobiCube\node_modules\@cubejs-backend\mongobi-driver\src\MongoBIDriver.ts:95:30) at MongoBIDriver.testConnection (E:\mongobiCube\node_modules\@cubejs-backend\mongobi-driver\src\MongoBIDriver.ts:165:63) at CubejsServerCore.getDriver (E:\mongobiCube\node_modules\@cubejs-backend\server-core\src\core\server.ts:727:20) at processTicksAndRejections
Mihir
  • 145
  • 11
  • Does the mongod log show the authentication failure? The log should show the username and database, so you can verify those are being passed correctly. – Joe Dec 29 '22 at 08:45
  • @Joe - The authentication is true and is being passed correctly in. – Mihir Dec 29 '22 at 10:28
  • So what is rejecting it? – Joe Dec 29 '22 at 10:51
  • @Joe I don't know what exactly it is being stopped by. I have attached a cube server image on the Question. please consider it again and suggest any. – Mihir Dec 29 '22 at 11:14
  • Please don't paste screenshots, use formatted text. See https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors – Wernfried Domscheit Dec 29 '22 at 14:48
  • Try `mechanism: SCRAM-SHA-256`. `SCRAM-SHA-1` is outdated, nowadays default is `SCRAM-SHA-256` – Wernfried Domscheit Dec 29 '22 at 15:52
  • Did you grant read privileges on schema database for user `kp`? See https://www.mongodb.com/docs/bi-connector/master/reference/mongosqld/#mongodb-setting-schema.stored.source – Wernfried Domscheit Dec 29 '22 at 15:59
  • `gssapiServiceName` is used for authentication via Kerberos tickets, which is most likely not used in your deployment. Thus, you can delete this parameter. – Wernfried Domscheit Dec 29 '22 at 16:02
  • @WernfriedDomscheit - I have already specified the role to user Kp - (readWriteAnyDatabase). I removed the gssapiServiceName and also modifies the mechanism, but still error persists. – Mihir Dec 30 '22 at 05:33

0 Answers0