ERROR 8: Deploying Meteor Web App


#1

this is my first time posting on these forums, but I seem to have issues trying to re-deploy my web app. I do not believe I changed any code since then, but the web app was deployed and was working a few days ago before it stopped. However, if it is locally hosted, then, it works perfectly fine.

I believe it has to deal with the way I use Meteor’s startup method.

ERROR

 [Fri Oct 16 2015 13:51:50 GMT+0000 (UTC)] WARNING Error: insert requires an argument
    at [object Object].Mongo.Collection.(anonymous function) [as insert (packages/mongo/packages/mongo.js:3884:1)
    at AccountsServer.Ap.insertUserDoc (accounts_server.js:1248:25)
    at createUser (packages/accounts-password/packages/accounts-password.js:1063:1)
    at AccountsServer.Accounts.createUser (packages/accounts-password/packages/accounts-password.js:1132:1)
    at system.js:917:1
    at Array.forEach (native)
    at Function._.each._.forEach (packages/underscore/packages/underscore.js:134:1)
    at Meteor.publish.currentUserID (system.js:914:1)
    at /meteor/containers/91c52aac-d24b-df57-9b01-c6d310a21999/bundle/programs/server/boot.js:249:5
    [Fri Oct 16 2015 13:51:50 GMT+0000 (UTC)] ERROR Application crashed with code: 8
    [Fri Oct 16 2015 13:51:50 GMT+0000 (UTC)] INFO STATUS running -> waiting
    [Fri Oct 16 2015 13:52:03 GMT+0000 (UTC)] INFO HIT / 69.80.162.139
    [Fri Oct 16 2015 13:52:09 GMT+0000 (UTC)] INFO HIT / 69.80.162.139
    [Fri Oct 16 2015 13:52:51 GMT+0000 (UTC)] INFO STATUS waiting -> starting
    [Fri Oct 16 2015 13:52:51 GMT+0000 (UTC)] NOTICE Starting application on port 20106
    [Fri Oct 16 2015 13:52:51 GMT+0000 (UTC)] INFO STATUS starting -> running
    [Fri Oct 16 2015 13:52:57 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.5.14/lib/node_modules/fibers/future.js:245
    throw(ex);
    ^

STARTUP METHOD

Meteor.startup(function (user) {
if (!Meteor.users.findOne()) {
var users = [
{name: “Admin User”, username: “admin”, roles: [‘admin’]},
{name: “Employee User”, username: “employee”, roles: [‘employee’]},
{name: “Supplier User”, username: “supplier”, roles: [‘supplier’]}

    ];
    _.each(users, function (user) {
        var id;
        id = Accounts.createUser({
            username: user.username,
            password: "apple1",
            profile: {name: user.name}
        });
        if (user.roles.length > 0) {
            // Need _id of existing user record so this call must come
            // after `Accounts.createUser` or `Accounts.onCreate`
            if (user.username == "admin") {
                Roles.addUsersToRoles(id, user.roles, Roles.GLOBAL_GROUP);
            }
            else {
                Roles.addUsersToRoles(id, user.roles);
            }
        }
    });
}

});

Sorry if my question is vague or incomplete, but thank you guys ahead of time for helping me!


#2

I can’t see anything obviously wrong with the main code, or what you’re wanting to do. Meteor.startup is a perfectly reasonable place for this. The only minor point is that the startup callback does not take any parameters (you shouldn’t have user in there) - OTOH, I can’t see that affecting deployment!


#3

I would like to be able to setup 3 default user accounts that are usable at deployment. Even when I try to just run,

Meteor.startup(function () {
    Accounts.createUser({
        username: "admin",
        password: "apple1"
    });
});

I’ve read the Meteor 1.2 Update notes, but nothing seems to pop out to me. It constantly tells me that the Mongo.Collection.insert requires an argument, but I do not see any issue since I’ve been able to do it before on deployment and locally.

Is it still possible to create User Account on the server side still?

Thanks again!