0

I have small issue and I don't know where to start: I have application error and I think my MongoLab database is not connecting correctly.

Here is link to heroku w2w.

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

And here is my config.json file:

{
"siteName": "PencilBlue Heroku and MongoDB Demo",
"siteRoot": "http://w2w.herokuapp.com",
"siteIP": "w2w.herokuapp.com",
"log_level": "info",
"db": {
    "type":"mongo",
    "servers": [
    "mongodb://hercules:MYPASSWORD@ds063330.mongolab.com:63330/pencilbluedb"
    ],
    "name": "pencilbluedb",
    "authentication": {
        "un": "hercules",
        "pw": "MYPASSWORD",
    },
    "writeConern": 1
},
"cache": {
    "fake": true,
    "host": "localhost",
    "port": 6379
},
"settings": {
    "use_memory": true,
    "use_cache": false
},
"templates": {
    "use_memory": true,
    "use_cache": false
},
"plugins": {
    "caching": {
        "use_memory": true,
        "use_cache": false
    }
}
} 

I have no idea why it's not loading. I followed the instructions here: Pencilblue link, the only difference is that I'm trying to connect to MongoLab and they are suggesting MongoHQ (which has already been changed to "compose").

Any help would be appreciated.

Magnilex
  • 11,584
  • 9
  • 62
  • 84
Hercules S.
  • 363
  • 3
  • 13
  • note that if you have the heroku CLI installed, you can tail your app's logs using "heroku logs --tail" https://devcenter.heroku.com/articles/logging#realtime-tail. if you have any more questions feel free to reach out to us at support@mongolab.com – Chris Chang Dec 13 '14 at 21:11
  • Chris, I run heroku logs --tail and got ton of respoce with "App crashed" code=H10. Since I'm new to mongo and node can you tell me what it means. – Hercules S. Dec 14 '14 at 02:51
  • you should start tailing the logs before you push changes for your app/restart your app. that way when your app crashes, you can see exactly what the error is. – Chris Chang Dec 14 '14 at 06:04

4 Answers4

1

Looks like the PencilBlue instructions do not have the db credentials as part of the mongodb connection string. Try leaving those out of the connection string and see if that fixes the problem. Just make sure you specify the credentials in the 'authentication' field which it looks like you are already doing.

Will
  • 11
  • 1
  • can you clarify what to comment out. I'm a bit lost since I just started learning this. Thank you. – Hercules S. Dec 14 '14 at 02:47
  • you're using "mongodb://hercules:MYPASSWORD@ds063330.mongolab.com:63330/pencilbluedb". try using "mongodb://ds063330.mongolab.com:63330/pencilbluedb" instead – Chris Chang Dec 14 '14 at 06:06
  • Oh, ok. I have tried this option first time I got this problem. It didnt solve it :( – Hercules S. Dec 14 '14 at 16:12
0

PencilBlue co-founder here.

You're missing the forward slash at the end of the MongoDB URL:

"mongodb://hercules:MYPASSWORD@ds063330.mongolab.com:63330/pencilbluedb/"
  • Dear C0-Founder! With all my respect and best wishes, I'm sorry but this doesn't help! Slash - no slash, credentials -no credentials. It says Application error. – Hercules S. Dec 18 '14 at 02:43
  • Well, if that's the case, set the log level to 'debug' or 'silly' and open up a ticket on our github so we can take a deeper look at it. – Blake Callens Dec 18 '14 at 18:56
0

I found this to work:

Say for instance this is your connection string URI

mongodb://heroku_td9xx269:vl3o3hsj6e61ib7kiaul0vsjrd@ds139725.mlab.com:39725/heroku_td9xx269

  "db": {
    "type": "mongo",
    "servers": [
         'mongodb://heroku_td9xx269:vl3o3hsj6e61ib7kiaul0vsjrd@ds139725.mlab.com:39725'
    ],
    "name": "heroku_td9mdp69",
    "authentication": {
        "un": "heroku_td9xx269",
        "pw": "vl3o3hsj6e61ib7kiaul0vsjrd",
    },
    "writeConcern": 1,
    "query_logging": false
},

The trick is to use your dbuser as the value to both the keys "un" and "name" fields.

Dr. Div
  • 951
  • 14
  • 26
0

It looks like you are defining your DB name twice, once in the URL and once on the "name" attribute. Remove the DB name from the URL. e.g

mongodb://hercules:MYPASSWORD@ds063330.mongolab.com:63330/

instead of

mongodb://hercules:MYPASSWORD@ds063330.mongolab.com:63330/pencilbluedb

And pencilblue should add the DB name when it connects.