coralproject / talk

A better commenting experience from Vox Media
https://coralproject.net
Other
1.89k stars 358 forks source link

When I connect my talk server to mongo atlas url the plugin stops working #2102

Closed hminaeeBrunswicknews closed 5 years ago

hminaeeBrunswicknews commented 5 years ago

Hi support,

we have a talk running perfectly fine with the following docker set up:

`

version: '2' services: talk: image: xxxx.dkr.ecr.us-east-1.amazonaws.com/container-example-test:latest restart: always ports:

`

The above code works fine. However as soon as I change the TALK_MONGO_URL to mongo atlas Url I got from a free account I created as follows:

`

version: '2' services: talk: image: xxxxx.dkr.ecr.us-east-1.amazonaws.com/container-example-test:latest restart: always ports:

`

I get the following error and talk stops working:

image

So the question is can we use MongoAtlas at all for talk?

If yes is there any trick or anything we need to follow to have it work?

kgardnr commented 5 years ago

You'll need to use the 3.4 or earlier driver syntax: https://www.mongodb.com/blog/post/mongodb-3-6-here-to-SRV-you-with-easier-replica-set-connections

kgardnr commented 5 years ago

More info here: https://docs.mongodb.com/manual/reference/connection-string/?_ga=2.86078608.9438358.1543519897-31358338.1540387923

hminaeeBrunswicknews commented 5 years ago

Thanks ,

when I switch to the <3.6 version admin page also stops working which was working with >3.6.

image

Also the comment now throw me a new error as follows:

image

Also here is the new url I use for Mongo variable:

mongodb://hamed1:xxxx@fargate4-shard-00-00-d8wly.mongodb.net:27017,fargate4-shard-00-01-d8wly.mongodb.net:27017,fargate4-shard-00-02-d8wly.mongodb.net:27017/test?ssl=true&replicaSet=fargate4-shard-0&authSource=admin

Also here is my mongoAtlas set up:

image

image

image

Any idea? @kgardnr @wyattjoh @losowsky

wyattjoh commented 5 years ago

The "Internal Error" is printed in production, with it logging the bug on the backend, what is the error you're seeing?

hminaeeBrunswicknews commented 5 years ago

Thanks @wyattjoh All I see is the below:

{"name":"talk","version":"4.5.1","revision":"76bb6df084f9ff910d394ecbb237faf83b331e26","hostname":"7be468006eb6","pid":26,"level":50,"err":{"message":"not found","stack":"Error: not found\n at new ExtendableError (/usr/src/app/errors.js:8:18)\n at new TalkError (/usr/src/app/errors.js:23:5)\n at new ErrNotFound (/usr/src/app/errors.js:236:5)\n at router.use (/usr/src/app/routes/index.js:149:8)\n at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)\n at /usr/src/app/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)\n at Immediate.next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)\n at Immediate.<anonymous> (/usr/src/app/node_modules/express/lib/router/index.js:635:15)\n at runCallback (timers.js:812:20)\n at tryOnImmediate (timers.js:768:5)\n at processImmediate [as _immediateCallback] (timers.js:745:5)"},"msg":"http error","time":"2018-11-30T17:08:23.887Z","src":{"file":"/usr/src/app/middleware/logging.js","line":36,"func":"error"},"v":0} and also:

stack: 'Error: Talk is currently not setup. Please proceed to our web installer at $ROOT_URL/admin/install or run ./bin/cli-setup. Visit https://docs.coralproject.net/talk/ for more information on installation and configuration instructions\n at new ExtendableError (/usr/src/app/errors.js:8:18)\n at new TalkError (/usr/src/app/errors.js:23:5)\n at new ErrSettingsNotInit (/usr/src/app/errors.js:267:5)\n at loadFn (/usr/src/app/services/settings.js:16:11)\n at <anonymous>', talk_1 | status: 500, talk_1 | translation_key: null, talk_1 | metadata: {} } talk_1 | {"name":"talk","version":"4.5.1","revision":"76bb6df084f9ff910d394ecbb237faf83b331e26","hostname":"7be468006eb6","pid":26,"level":50,"err":{"message":"not found","stack":"Error: not found\n at new ExtendableError (/usr/src/app/errors.js:8:18)\n at new TalkError (/usr/src/app/errors.js:23:5)\n at new ErrNotFound (/usr/src/app/errors.js:236:5)\n at router.use (/usr/src/app/routes/index.js:149:8)\n at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)\n at /usr/src/app/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)\n at Immediate.next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)\n at Immediate.<anonymous> (/usr/src/app/node_modules/express/lib/router/index.js:635:15)\n at runCallback (timers.js:812:20)\n at tryOnImmediate (timers.js:768:5)\n at processImmediate [as _immediateCallback] (timers.js:745:5)"},"msg":"http error","time":"2018-11-30T17:11:03.889Z","src":{"file":"/usr/src/app/middleware/logging.js","line":36,"func":"error"},"v":0}

wyattjoh commented 5 years ago

As you likely pointed your application to a fresh Atlas install, you need to run the setup in order to see your comments.

It looks like you did try that, so if you can also provide the console logs from the install page, we can see why the install is failing.

hminaeeBrunswicknews commented 5 years ago

@wyattjoh

When I run it I get this:

stack: 'Error: Talk is currently not setup. Please proceed to our web installer at $ROOT_URL/admin/install or run ./bin/cli-setup. Visit https://docs.coralproject.net/talk/ for more information on installation and configuration instructions\n at new ExtendableError (/usr/src/app/errors.js:8:18)\n at new TalkError (/usr/src/app/errors.js:23:5)\n at new ErrSettingsNotInit (/usr/src/app/errors.js:267:5)\n at loadFn (/usr/src/app/services/settings.js:16:11)\n at <anonymous>', talk_1 | status: 500, talk_1 | translation_key: null, talk_1 | metadata: {} } talk_1 | {"name":"talk","version":"4.5.1","revision":"76bb6df084f9ff910d394ecbb237faf83b331e26","hostname":"7be468006eb6","pid":26,"level":50,"err":{"message":"not found","stack":"Error: not found\n at new ExtendableError (/usr/src/app/errors.js:8:18)\n at new TalkError (/usr/src/app/errors.js:23:5)\n at new ErrNotFound (/usr/src/app/errors.js:236:5)\n at router.use (/usr/src/app/routes/index.js:149:8)\n at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)\n at /usr/src/app/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)\n at Immediate.next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)\n at Immediate.<anonymous> (/usr/src/app/node_modules/express/lib/router/index.js:635:15)\n at runCallback (timers.js:812:20)\n at tryOnImmediate (timers.js:768:5)\n at processImmediate [as _immediateCallback] (timers.js:745:5)"},"msg":"http error","time":"2018-11-30T17:22:05.019Z","src":{"file":"/usr/src/app/middleware/logging.js","line":36,"func":"error"},"v":0} talk_1 | {"name":"talk","version":"4.5.1","revision":"76bb6df084f9ff910d394ecbb237faf83b331e26","hostname":"7be468006eb6","pid":26,"level":30,"traceID":"75192670-f4c4-11e8-91ed-8f2a64423c1e","url":"/api/v1/live","method":"GET","statusCode":404,"userAgent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","responseTime":5,"msg":"http request","time":"2018-11-30T17:22:05.019Z","src":{"file":"/usr/src/app/middleware/logging.js","line":19,"func":"res.end"},"v":0}

wyattjoh commented 5 years ago

When you try to install Talk, what is the logs you see in the web browser when you see that "undefined" popup?

hminaeeBrunswicknews commented 5 years ago

@wyattjoh

Here is what I see :

image

image

image

Here is mongo url I am using and it is widely open in case if you need it:

mongodb://hamed1:11111@fargate4-shard-00-00-d8wly.mongodb.net:27017,fargate4-shard-00-01-d8wly.mongodb.net:27017,fargate4-shard-00-02-d8wly.mongodb.net:27017/test?ssl=true&replicaSet=fargate4-shard-0&authSource=admin

immber commented 5 years ago

@hminaeeBrunswicknews I was just able to go to your talk instance at https://commenthamed5.stg1.dev-telegraphjournal.com/admin/moderate, and complete the setup with the same credentials you provided in your screenshot above.

I also tested connecting to the MongoDB instance that you reference mongodb://hamed1:11111@fargate4-shard-00-00-d8wly.mongodb.net, but that does not seem to be the mongo instance that the Talk instance I just logged into is connected to. In the mongo instance, I see a test db with one user, but not the talk db or the user I just created.

It looks like either you've resolved the issue with connecting to the DB or Talk is connecting to a different instance than expected. Can you confirm if you've resolved the connection issue or if you're able to login and access the moderation interface?

hminaeeBrunswicknews commented 5 years ago

@immber

Thanks a lot for your help. It worked!!!!!!!!!! I just updated the mongo url to point at the cluster you changed. Can you please explain what changes you made? Did you change anything in mongo cluster?

immber commented 5 years ago

@hminaeeBrunswicknews I only connected to the mongo instance and queried it, I made no configuration changes.

On the talk instance, I also made no config changes, but I connected to the url you provided, and walked thru the setup steps using the same credentials that you had provided in your screenshot. Make sure you change your login pwd :)

I think you fixed it by updating the mongo url, and pointing at a different mongo instance. As I said, I don't see the user I created in the @fargate4-shard-00-00-d8wly.mongodb.net instance, so I think Talk is connecting to a different mongo instance. As long as you know what instance that is, you should be good to go!

hminaeeBrunswicknews commented 5 years ago

@immber

Actually right now it is connected to @fargate4-shard-00-00-d8wly.mongodb.net How can I query the db to see if my user exist over there?

immber commented 5 years ago

@hminaeeBrunswicknews I like MongoDB Compass, available here: https://www.mongodb.com/products/compass

You just connect with your connection string, and you will be able to explore and interact with the data in your mongo instance.

hminaeeBrunswicknews commented 5 years ago

@immber

Thanks a lot @immber

Just to double check I am going to create a new mongo cluster in atlas and test it that way. I will get back and let you know about the result.

hminaeeBrunswicknews commented 5 years ago

Thanks,

It worked. It turned out to be a caching issue. When I try it in incognito window it works.

Thanks for your help