Can't connect to mLab using Glitch console


#1

I’ve been trying to work on FreeCodeCamp’s API projects, URL Shortener Microservice, and tried to integrate a mongodb for this project. As per FCC’s recommendations, I created an account for mLab since it allows a limited database for free.
The problem is during the testing, i’m experiencing issues on connection. Here’s the error:

2017-11-01T20:31:03.572+0000 Error: 18 { ok: 0.0, errmsg: “auth failed”, code: 18, codeName: “AuthenticationFailed” } at src/mongo/shell/db.js:1287

I’ve done some research and it mentions that the cause might be due to incompatible mongodb versions. I tried to update mongod version to 3.4.9 on glitch like the one on matlab, but it won’t let me. Does anyone know how to resolve this?


#2

I recommend taking a look at the setup of our MongoDB example app https://glitch.com/edit/#!/mongodb and verifying you’re constructing the MongoDB url correctly and your setup is correct. You shouldn’t be needing to update mongod versions.


#3

Hello Gareth,

I tested it and verified its working correctly using my nodejs app. Thank you for the example.

I’m assuming though that it’s not possible to connect to mongodb using the glitch console and the reason i wanted to initially was to do a quick test for the connection.


#4

Hi @Gareth and @midnitedev101 after reading some mlab FAQs it seems that the glitch console default mongodb shell version is 2.6.10 and mlab requires version 3.0.x @Gareth is there a way to upgrade the shell version in the glitch console?

From http://docs.mlab.com/connecting/#help
Mongo shell
If you are having trouble connecting (and authenticating) to your mLab database using the mongo shell, check to see that you are using a shell version that matches the release version of your mLab-hosted deployment. For example, if your database is running MongoDB 3.0.x, then your shell version should also be 3.0.x.