Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heroku deploy failed after updating to mongoDB 2.6.4; Error: database names cannot contain the character '.'" #128

Closed
Kyii opened this issue Aug 18, 2014 · 9 comments

Comments

@Kyii
Copy link

Kyii commented Aug 18, 2014

Hi,
i have been running this great ultimate-seed at Heroku and it has been working fine on the free tier MongoHQ (now Compose) with MongoDB 2.4 database but on upgrading to the 1GD SSD with mongoDB 2.6.4 i get an application error. looking at the logs I'm getting this error:

"stack": [
2014-08-18T13:59:54.665599+00:00 app[web.1]:     "Error: database names cannot contain the character '.'",
2014-08-18T13:59:54.665600+00:00 app[web.1]:     "    at validateDatabaseName (/app/node_modules/ultimate/node_modules/connect-mongo/node_modules/mongodb/lib/mongodb/db.js:187:59)",
2014-08-18T13:59:54.665602+00:00 app[web.1]:     "    at new Db (/app/node_modules/ultimate/node_modules/connect-mongo/node_modules/mongodb/lib/mongodb/db.js:74:3)",
2014-08-18T13:59:54.665603+00:00 app[web.1]:     "    at new MongoStore (/app/node_modules/ultimate/node_modules/connect-mongo/lib/connect-mongo.js:101:19)",
2014-08-18T13:59:54.665605+00:00 app[web.1]:     "    at Object.attach (/app/node_modules/ultimate/lib/server/middleware/session/mongo.js:61:12)",
2014-08-18T13:59:54.665606+00:00 app[web.1]:     "    at Function.<anonymous> (/app/node_modules/ultimate/lib/server/express.js:70:23)",
2014-08-18T13:59:54.665607+00:00 app[web.1]:     "    at Function.app.configure (/app/node_modules/ultimate/node_modules/express/lib/application.js:393:61)",
2014-08-18T13:59:54.665609+00:00 app[web.1]:     "    at _configure (/app/node_modules/ultimate/lib/server/express.js:39:11)",
2014-08-18T13:59:54.665610+00:00 app[web.1]:     "    at Object.run (/app/node_modules/ultimate/lib/server/express.js:210:3)",
2014-08-18T13:59:54.665612+00:00 app[web.1]:     "    at Object.app.run (/app/server/app.js:101:27)",
2014-08-18T13:59:54.665613+00:00 app[web.1]:     "    at Object.<anonymous> (/app/server/index.js:7:45)"
2014-08-18T13:59:54.665614+00:00 app[web.1]:   ],
2014-08-18T13:59:54.665616+00:00 app[web.1]:   "level": "error",
2014-08-18T13:59:54.665617+00:00 app[web.1]:   "message": "uncaughtException: database names cannot contain the character '.'"
2014-08-18T13:59:54.665618+00:00 app[web.1]: }

of course there is no . in the database name. config file is ok like this (fake data)

"db": {
    "mongo": {
      "host": "candidate.34.mongolayer.com",
      "port":12637,
      "username": "wqJ69s7h43vYX8nydQ",
      "password": "​wqJ69s7h43vYX8nydQ",
      "db":"app354657578"
    },

there is almost the same issue with another MEAN like repository:
angular-fullstack/generator-angular-fullstack#416

they suggest to remove the usage of mongodb as session store if i got it right. but i use it as session store.

any help very much appreciated!

@nicolaslair
Copy link

Hey Kyli,

I am facing exactly the same issue so I am wondering if you found any solution? I know I could switch to Connect-Redis instead but I am trying to avoid doing that :)

Thanks in advance ;)

@Kyii
Copy link
Author

Kyii commented Sep 19, 2014

hey nicolaslair,

there was a somehow similar issue running on mongolab after updating from mongodb 2.4 to 2.6.4.
a database connection could not be established because of some error in connect-mongo.
luckily i solved the issue updating connect-mongo to the latest-version (0.4.1) in the node-ultimate repository. unfortunately i don't know exactly what caused the error in the first place.

what about you?

@Kyii Kyii closed this as completed Sep 21, 2014
@nicolaslair
Copy link

Thanks Kyli, I tried different updates yesterday but I am still facing the same issue. Could I ask you how you initialise connect-mongo for the replica sets?

@hailiang-wang
Copy link

I am facing the same issue, I also use mongodb instances of mongolab.
To make it more clear, my db url is like this

mongodb://foo:bar@d1.mongolab.com:39530,d2.mongolab.com:39530/helloworld

But if the url just have one host, such as mongodb://foo:bar@d1.mongolab.com:39530/hw, then it works.

@stepri
Copy link

stepri commented Nov 20, 2014

Same issue here, with 2 hosts in the url

@ericwebster
Copy link

I am having the same issue after installing "connect-mongo" to solve a session store issue I was having. Also if I uninstall that package it works.

Still looking for a solution.

@etinif
Copy link

etinif commented Dec 16, 2014

connect-mongo is still broken with compose.io. any alternatives for mongodb session storage?

@nicolaslair
Copy link

Hi all, I got it working by using mongoose and sending the db param to
connect-mongo:

var mongoUri = process.env.MONGOHQ_URL:
var mongoose = require ("mongoose");

mongoose.connect(mongoUri, {safe: true, auto_reconnect: true });

app.use(express.session({
store: new MongoStore({ db: mongoose.connection.db }),
secret: "...",
cookie: {
maxAge: ...
}
}));

Hope it helps you guys, it's on production and is working fine for me!

Niko

On Tue, Dec 16, 2014 at 6:03 PM, etinif notifications@github.com wrote:

connect-mongo is still broken with compose.io. any alternatives for
mongodb session storage?


Reply to this email directly or view it on GitHub
#128 (comment)
.

niko

@samlevan
Copy link

samlevan commented Feb 6, 2015

Thanks Niko! The workaround you suggested worked well for us too (we use compose.io).

Used a code bit like:

var connection = mongoose.createConnection(connectionOptions);
app.use(session({
    store: new MongoStore({ mongooseConnection: connection })
}));

Also, version 0.7 of connect-mongo now supports multiple hosts in the url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants