Session Mismatch errors

Unsolved Technical Support
  • I've gone through some of the previous topics on this subject but haven't found an answer that fits yet. I'm geting periodic reports of users getting the "Session Mistmatch" error along with the "Your connection was lost" message. This instance of nodeBB is routed through Cloudflare and flushing the CF cache gets rid of the errors. Any suggestions on where to look for the root cause? Any ideas on how to provoke ths error on demand would be much appreciated so I can identify and test the fix.

    I am using the Session Sharing plugin, but it appears that this issue occurs because some request is getting cached by CF rather than at the origin as the request never makes it to nodeBB.

  • I've put in a cache rule to bypass caching when the path contains

    (http.request.uri.path contains "/")

    Hopefully this fixes the intermittent problem, but it would be nice to be able to validate and test the fix.

  • @razibal It might be good to know what your CF-specific settings are for the site.

    The session mismatch error shows up if when the frontend does a checkSession call, the server returns with a different uid.

    It may be worth adding a debug log at that point (public/src/sockets.js line 89), and having your users tell you what uid is returned.

    Outside of CF, it might be something as simple as the session is expiring too quickly.

  • @julian I'll add the debug log, however since the main site already uses datadog for logging/RUM (Real User Monitoring), I think this would be a good opportunity to add the embedded nodeBB instance to datadog.
    It looks like datadog has a winston module datadog-winston. Any suggestions on the best place to integrate this without having to modify core?

  • @razibal It looks to be that this module adds a new logger to winston. There's no specific place it needs to be.

    For example you could just put it in a custom plugin:

    const winston = require.main.require('winston');
    // below... copied from their readme
    var DatadogWinston = require('datadog-winston')
    var logger = winston.createLogger({
      // Whatever options you need
      // Refer
      new DatadogWinston({
        apiKey: 'super_secret_datadog_api_key',
        hostname: 'my_machine',
        service: 'super_service',
        ddsource: 'nodejs',
        ddtags: 'foo:bar,boo:baz'
  • @julian I ended up adding the datadog RUM and logger scripts to the header.tpl of my custom theme.

    The user sessions are now visible in the datadog UI and any requests for checkSession are logged.

    I haven't had any reports of errors since I added a cache bypass for / . Hopefully, if this occurs again I'll have the logs as well as any untrapped errors visible in the RUM sessions.

  • It finally happened again, Looks like app.user.uid doesn't match the logged in user uid as is set to 0 while the uid is 2.
    It all starts working again as soon as I flush the Cloudflare cache.
    Where are the app values gettting set?

Suggested Topics

  • 0 Votes
    7 Posts

    Your initial header.tpl should work with the latest version of nodebb, app.template is no longer necessary since that is available in

  • 0 Votes
    4 Posts

    At last I did a upgrade : ./nodebb upgrade

    I think the plugin I deinstalled has some links with theme, after upgrade the missing files should be replaced again.


  • Application error

    Technical Support
    1 Votes
    1 Posts

    I setup nodebb on heroku following below tut nodebb.readthedocs. io/en/latest/installing/cloud/heroku.html
    Nodebb working well locally. But on heroku I get application error.
    forum-host.herokuapp. com/
    Here is the log
    http:// pasted. co/e0f98486
    changed link as askmi spam filter not allowing to post links

  • Upgrade error

    Technical Support
    0 Votes
    4 Posts

    Run npm i commander on 1.7.x and try again.

  • 1 Votes
    1 Posts

    Hi guys!

    I have previous 0.5.0-2 version of forum on Heroku. It works fine. When I updated NodeBB to 0.6.1 version it crashed with error. Any ideas?

    2015-04-30T06:31:05.151177+00:00 heroku[web.1]: State changed from crashed to starting
    2015-04-30T06:31:12.946261+00:00 heroku[web.1]: Starting process with command npm start
    2015-04-30T06:31:16.159469+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
    2015-04-30T06:31:16.159494+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
    2015-04-30T06:31:16.817884+00:00 app[web.1]:
    2015-04-30T06:31:16.817890+00:00 app[web.1]: > [email protected] start /app
    2015-04-30T06:31:16.817892+00:00 app[web.1]: > ./nodebb start
    2015-04-30T06:31:16.817893+00:00 app[web.1]:
    2015-04-30T06:31:16.854535+00:00 app[web.1]: sh: 1: ./nodebb: Permission denied
    2015-04-30T06:31:16.873738+00:00 app[web.1]: npm ERR! Linux 3.13.0-49-generic
    2015-04-30T06:31:16.878037+00:00 app[web.1]: npm ERR! code ELIFECYCLE
    2015-04-30T06:31:16.878041+00:00 app[web.1]: npm ERR! [email protected] start: ./nodebb start
    2015-04-30T06:31:16.878043+00:00 app[web.1]: npm ERR! Exit status 126
    2015-04-30T06:31:16.878044+00:00 app[web.1]: npm ERR!
    2015-04-30T06:31:16.878046+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script './nodebb start'.
    2015-04-30T06:31:16.878048+00:00 app[web.1]: npm ERR! This is most likely a problem with the nodebb package,
    2015-04-30T06:31:16.878049+00:00 app[web.1]: npm ERR! not with npm itself.
    2015-04-30T06:31:16.878050+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
    2015-04-30T06:31:16.878052+00:00 app[web.1]: npm ERR! ./nodebb start
    2015-04-30T06:31:16.878054+00:00 app[web.1]: npm ERR! You can get their info via:
    2015-04-30T06:31:16.878693+00:00 app[web.1]: npm ERR! npm owner ls nodebb
    2015-04-30T06:31:16.878696+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
    2015-04-30T06:31:16.889120+00:00 app[web.1]:
    2015-04-30T06:31:16.899848+00:00 app[web.1]: npm ERR! /app/npm-debug.log
    2015-04-30T06:31:16.866363+00:00 app[web.1]:
    2015-04-30T06:31:16.874577+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
    2015-04-30T06:31:16.875101+00:00 app[web.1]: npm ERR! node v0.12.2
    2015-04-30T06:31:16.876089+00:00 app[web.1]: npm ERR! npm v2.7.4
    2015-04-30T06:31:16.897668+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
    2015-04-30T06:31:17.925842+00:00 heroku[web.1]: Process exited with status 1
    2015-04-30T06:31:17.938969+00:00 heroku[web.1]: State changed from starting to crashed