Question

I have a pretty straight code that writes one field to a hosted MongoDB, using the standard mongodb module. The application itself is running on Heroku and was working well for almost a year, when I started getting errors on the client side.

I added some console logs, and found 2 errors, coming from my db module:

1.

Failed to load c++ bson extension, using pure JS version
    throw err;
    at Object.Module._extensions..js (module.js:474:10)
    at Object.<anonymous> (/app/node_modules/mongodb/lib/mongodb/collection.js:14:14)
    at Function.Module._load (module.js:280:25)

2.

Error: Cannot find module './collection/shared'
    at Function.Module._resolveFilename (module.js:338:15)

module.js:340
    at require (module.js:380:17)
    at Module.require (module.js:364:17)
          ^
    at Module.require (module.js:364:17)
    at Module._compile (module.js:456:26)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    Process exited with status 8
    State changed from up to crashed

I cannot replicate those errors on my Mac - everything seems to work fine (accessing the same DB as the one on Heroku). I tried rolling back to mongodb v1.2 - no help, same errors.

Couldn't find anything on the googles or mongodb's JIRA, so I'd appreciate any help. For now, I surrounded the entire call with a try-catch, so it doesn't crash (but still doesn't work).

Update:
The try-catch doesn't help - I get the result once, but the app is marked as 'crashed' on Heroku, so I have to restart it manually. Will avoid DB call until issue resolved.

Was it helpful?

Solution

I opened an issue on MongoDB's JIRA, and following a comment, I reset my app on Heroku. With Node v0.10.23, the problem never repeated itself. I still don't know what was the root cause, but I guess all is well now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top