Skip to content

Error: Callback was already called #28

@DundieWinner

Description

@DundieWinner

I am working through Chapter 8, page 177 where I am trying to get the photo album server to startup after implementing the very first steps in MongoDB integration, and I keep getting the same error sequence:

..\Node\Tutorial\photo_album_express\app\node_modules\mongodb\lib\mongo_client.js:350
throw err
^
Error: Callback was already called.
at ..\Node\Tutorial\photo_album_express\app\node_modules\async\dist\async.js:840:32
at Db.collection (..\Node\Tutorial\photo_album_express\app\node_modules\mongodb\lib\db.js:457:27)
at async.waterfall.exports.albums (..\Node\Tutorial\photo_album_express\app\data\db.js:33:16)
at nextTask (..\Node\Tutorial\photo_album_express\app\node_modules\async\dist\async.js:5070:14)
at ..\Node\Tutorial\photo_album_express\app\node_modules\async\dist\async.js:5064:13
at apply (..\Node\Tutorial\photo_album_express\app\node_modules\async\dist\async.js:21:25)
at ..\Node\Tutorial\photo_album_express\app\node_modules\async\dist\async.js:56:12
at ..\Node\Tutorial\photo_album_express\app\node_modules\async\dist\async.js:843:16
at MongoClient.connect (..\Node\Tutorial\photo_album_express\app\data\db.js:25:17)
at connectCallback (..\Node\Tutorial\photo_album_express\app\node_modules\mongodb\lib\mongo_client.js:428:5)

The "db.js:33:16" is referencing the db.collection("albums", cb); line and the "db.js:25:17" is referencing the cb(null) line within the MongoClient.connect function.

I even tried replacing my data/db.js file with exactly what you provide in repository (https://github.com/marcwan/LearningNodeJS/blob/master/Chapter08/02_create_album/app/data/db.js)

I've searched around but I can't seem to figure out this snag. What is happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions