Error: Connection closed - What is this?

I am building an app in my local environment. Yesterday, all of a sudden (without making any serious changes to anything), I was unable to insert into a collection using autoform. It simply said ‘Please fill required fields’ and so I thought it was something to do with the schema (which I had made minor changes). So I undid the changes I made and still did’t work.

Then I checked the error on the server and saw something starting with this…

Exception while invoking method ‘shapes/insert’ Error: connection closed

Then I tried saving other types of components in the app (contacts, ingredients, recipes etc), which were all working fine before, and I didn’t make any changes to their respective files. All showed the same/similar error.

I then logged out of my test account and tried to log back in, but I couldn’t. Same/similar error again…

Exception while invoking method 'login' Error: connection closed
at Object.Future.wait (/Users/iMac/.meteor/packages/meteor-tool/.
at [object Object].<anonymous> (packages/meteor/helpers.js:119:1)
at [object Object].MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:736:1)
at Object.CollectionHooks.defineAdvice.self (packages/matb33_collection-hooks/update.js:80:1)
at Object.collection.(anonymous function) [as update] (packages/matb33_collection-hooks/collection-hooks.js:117:1)
at [object Object].Mongo.Collection.(anonymous function) (packages/mongo/collection.js:590:1)
at [object Object].Mongo.Collection.(anonymous function) [as update] (packages/aldeed_collection2-core/lib/collection2.js:191:1)
at AccountsServer.Ap._insertHashedLoginToken (accounts_server.js:821:14)
at AccountsServer.Ap._insertLoginToken (accounts_server.js:831:8)
at AccountsServer.Ap._loginUser (accounts_server.js:269:10)
at AccountsServer.Ap._attemptLogin (accounts_server.js:340:12)
at [object Object].methods.login (accounts_server.js:524:21)
at maybeAuditArgumentChecks (livedata_server.js:1698:12)
at livedata_server.js:708:19
at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
at livedata_server.js:706:40
- - - - -
at [object Object].<anonymous> (/Users/iMac/.meteor/packages/npm-mongo/.1.4.39_1.17b8oex++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:610:98)
at [object Object].emit (events.js:92:17)
at [object Object].<anonymous> (/Users/iMac/.meteor/packages/npm-mongo/.1.4.39_1.17b8oex++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:171:15)
at [object Object].emit (events.js:98:17)
at Socket.<anonymous> (/Users/iMac/.meteor/packages/npm-mongo/.1.4.39_1.17b8oex++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection.js:550:12)
at Socket.emit (events.js:95:17)
at TCP.close (net.js:466:12)

I then did a meteor update. No difference.

I have tried Googling ‘meteor Error: Connection closed’ but can’t find anything remotely related.

Can someone tell me what’s happened to my app?


I assume you’re using version control (like Git)? In which case, revert to the commit prior to your changes and test again. Then apply intervening commits (or changes) to isolate the reason.

I’m having this same issue in my production meteor app – along with this:

Exception while invoking method 'login' Error: No replica set primary available for query with ReadPreference PRIMARY

Looks like the client isn’t able to access the db. The error is resolved temporarily when I redeploy with an empty commit. But it’s coming up again and again and causing big issues for us.

Anyone have any success with this?

For me is similar, I reported it here.