Bug or Security Feature, I'm not really sure.

Bug Reports
  • Hello,

    First off let me say thanks for such an awesome package. It was a royal pain to get going, but my use case is hardly typical (dev on cloud9 and prod on openshift), with mongodb as a backend so it can run on smaller instances and still scale.

    After finally fighting it to getting installed on Cloud9 and setting up my first user, I'm not able to log in to the admin console.

    I'm really not sure what to do now. I'm assuming it's something wierd with my setup. I never recieved the admin email. My guess is that C9 didn't send the email for whatever reason and I'm not in a position where I can really sit and troubleshoot that at the moment.

    Long story short I need to get into my admin console. I can login as a user successfully...
    info: NodeBB Ready
    info: [socket] uid 1 (yFrv5pe__CPy9mq142vX) has successfully reconnected.
    info: [socket] uid 1 (TayjaKG-AR887H4K42vY) has successfully reconnected.

    However attempting to go to http://orgcoin-c9-auberon.c9.io/admin results in a redirect to a 403 error page.

    Access Denied

    You seem to have stumbled upon a page that you do not have access to. Perhaps you should try logging in?

    For all intents and purposes I do appear to be logged in. I just can't get to admin.
    There are no errors coming from Mongo and I have mongod spewing direct to the console so I would expect to see an error of some sort.

    The only thing I can think of is there was a "Welcome" email sent to the admin account that never made it through and now I'm stuck in some sort of in-between state.

    Any pointers on what to do from here?
    Thanks in advance!

    p.s. If this ends up working out as being what we build our site off from, I think I would like to have you guys drop buy and build a better theme.

    p.p.s. You need to take a closer look at your front page at www.nodebb.org, several of the "Featured Forums" look to be offline.

  • Hey @Oberon!

    When you first ran node app --setup, it should have asked you a number of questions re: directory setup + database. It should also have asked you for your administrator username, email, and password. These are the credentials that you'll need to access the admin panel.

    Once you have your NodeBB up and running, you'll actually have to login (by going to /login), and then, you can access /admin.

    NodeBB doesn't send a welcome email because it relies on the installation of a third-party plugin (i.e. mandrill, mailgun, local). It doesn't ship with one by default (though maybe it should!)

    If you truly are logged in (as in, you see your avatar at the top right), then perhaps your web sockets aren't working? If you open your console/inspector, are you seeing repeated XHR requests to an url that contains xhr-polling or json-polling? This is indicative of web sockets not properly connecting.

  • It never asked me any of those questions.

    Running it again though...

    info: NodeBB Setup Triggered via Command Line
    info: Welcome to NodeBB!
    info: This looks like a new installation, so you'll have to answer a few questions about your environment before we can proceed.
    info: Press enter to accept the default setting (shown in brackets).
    URL of this installation (http://www.orgcoin.org) 
    Port number of your NodeBB (80) 
    Use a port number to access NodeBB? (n) 
    Please enter a NodeBB secret (ae7e55f3-3191-45ec-9f69-1d75266aa044) 
    IP or Hostname to bind to ( 
    Which database to use (mongo) 
    Host IP or address of your MongoDB instance ( 
    Host port of your MongoDB instance (27017) 
    MongoDB username **scrubbed**
    Password of your MongoDB database **scrubbed**
    Which database to use (0..n) (0) 
    info: Configuration Saved OK
    info: Populating database with default configs, if not already set...
    warn: No administrators have been detected, running initial user setup
    Administrator username Oberon
    Administrator email address [email protected]
    Confirm Password 
            throw message;      
    ReferenceError: templates is not defined
        at render (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/src/emailer.js:13:6)
        at Object.async.parallel.html (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/src/emailer.js:25:4)
        at /var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/node_modules/async/lib/async.js:521:25
        at /var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/node_modules/async/lib/async.js:108:13
        at Array.forEach (native)
        at _each (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/node_modules/async/lib/async.js:32:24)
        at Object.async.each (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/node_modules/async/lib/async.js:107:9)
        at _parallel (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/node_modules/async/lib/async.js:520:20)
        at Object.async.parallel (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/node_modules/async/lib/async.js:536:9)
        at Object.Emailer.send (/var/lib/stickshift/52d44bc7500446ef900000e7/app-root/data/737448/NodeBB/src/emailer.js:23:8)

    Not really sure where to go from here 😞

  • Yikes... and that only happens with Mongo, hm?

    We'll have to take a look at that today!

  • Not sure node why app --setup wants to use ./src/emailer.js

  • Never tried it with Redis, but @psychobunny had a tutorial on getting nodebb going on Cloud9. I basically followed it and substituted mongo for reddis. Still the fact a tutorial is posted about C9 without any sort of caveats, in my mind points to "this is an issue only when using mongo".

  • Ok so here's an update...

    Something must've gone wrong during the initial setup. Like I said before I really had to fight to figure out the right way to get NodeBB to play nice with mongo on Cloud9.
    I was able to solve the issue and here's how (maybe the HOWTO run on Cloud9 can be updated with this information).

    First I shut down mongo and node completely.
    Next I restarted mongod, logged into mono shell.
    Typed "use 0"
    Then db.dropDatabase(0)

    Next I recreated DB 0 and added an user with readWrite & dbAdmin roles.
    use 0

    Afterwards I exited the shell and restarted mongo again (that may not have been nessecary).

    Finally I went ahead and ran node app --setup again.
    It worked flawlessly that time.
    I'm now in and able to perform all the admin functions. Also the site just plain looks better right now. My guess is that some junk was caught up in the DB and effecting the theme/layout and other misc bits that put the spit and polish on the site.

    Now, for my next trick I've got to find a way for the application to pick up it's settings (esp DB settings) from environment variables. That way when a new instance is spun up it will connect to the proper DB instance and do it's thing. Fortunately in OpenShift the mongodb vars come pre-set. Unfortunately the DB is inaccessible from outside the OpenShift environ so there is no way to test DB connectivity until I push the codebase up to the instances.

    It's going to be fun. When I get it figured out I'll submit a patch if you're interested to allow Node to get it's settings from environment vars instead of config.json, thus allowing it to fire right up on OpenShift (possibly AWS as well).

  • @BarveyHirdman said:

    Not sure node why app --setup wants to use ./src/emailer.js

    That file is required during admin user creation because we send the "welcome to NodeBB" email during the user creation process.

    A little redundant, as third-party emailers aren't even installed or setup yet during installation, but that's specifically the reason why it is being require'd

Suggested Topics