Problem with _csrf token



  • Hello, I've finally stepped in creating my NodeBB distant server on Digital Ocean. So far so good but I have a big problem related to _csrf token resulting in error 500 while saving anything in ACP.

    Here's the error log

        Error: invalid csrf token
            at verifytoken (/home/esiao/gg_nodebb/node_modules/csurf/index.js:234:13)
            at csrf (/home/esiao/gg_nodebb/node_modules/csurf/index.js:94:7)
            at Layer.handle [as handle_request] (/home/esiao/gg_nodebb/node_modules/express/lib/router/layer.js:76:5)
            at trim_prefix (/home/esiao/gg_nodebb/node_modules/express/lib/router/index.js:263:13)
            at /home/esiao/gg_nodebb/node_modules/express/lib/router/index.js:230:9
            at Function.proto.process_params (/home/esiao/gg_nodebb/node_modules/express/lib/router/index.js:305:12)
            at /home/esiao/gg_nodebb/node_modules/express/lib/router/index.js:221:12
            at Function.match_layer (/home/esiao/gg_nodebb/node_modules/express/lib/router/index.js:288:3)
            at next (/home/esiao/gg_nodebb/node_modules/express/lib/router/index.js:182:10)
            at multipart (/home/esiao/gg_nodebb/node_modules/connect-multiparty/index.js:42:27)
    

    It's not version related (both 0.5.0 and 0.5.1) have the problem.
    Any idea ?



  • @esiao Duplicate of this topic.

    Try clearing Cache & Cookies.



  • @a_5mith Clearing the cache/cookies didn't change anything 😞
    Additionaly I have this warning

    warn: Route requested but not found: /src/modules/semver.js
    

    And _csrf input is empty in DOM

    <input type="hidden" id="csrfToken" name="_csrf">


  • Some new information since I have some friends on my forum now.
    They have the same issue when they try to change their avatar (upload an image/changing a plugin config is causing the problem).
    The server output message is exactlly the same. There's a 500 error by the way.


  • GNU/Linux Admin

    @esiao Hmm... the csrf excision changes shouldn't be in 0.5.0, please make sure that if you're on 0.5.0, that you also have the 0.5.0 themes. They have version numbers in the 0.0.x range.

    0.5.1 is unstable at the moment and presents with these csrf bugs, but they are fixed in the experimental branch we're merging in soon.



  • @julian It's weird my vanilla theme is on master branch but the version is "version": "0.1.1"


  • GNU/Linux Admin

    @esiao Yes, you'll have to manually install the older version: npm i nodebb-theme-vanilla@~0.0.0



  • @julian I have the following error

      npm ERR! git Appears to be a git repo or submodule.
      npm ERR! git     /home/esiao/gg_nodebb/node_modules/nodebb-theme-vanilla
      npm ERR! git Refusing to remove it. Update manually,
      npm ERR! git or move it out of the way first.
    
      npm ERR! System Linux 3.13.0-24-generic
      npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "nodebb-theme-vanilla@~0.0.0"
      npm ERR! cwd /home/esiao/gg_nodebb
      npm ERR! node -v v0.10.25
      npm ERR! npm -v 1.3.10
      npm ERR! path /home/esiao/gg_nodebb/node_modules/nodebb-theme-vanilla
      npm ERR! code EISGIT
      npm ERR!
      npm ERR! Additional logging details can be found in:
      npm ERR!     /home/esiao/gg_nodebb/npm-debug.log
      npm ERR! not ok code 0
    

    Any way to restore an older version with git ? (revert to a commit maybe)


  • Plugin & Theme Dev Anime Lovers GNU/Linux

    I get the same error...

    warn: Route requested but not found: /src/modules/semver.js in the ACP.

    edit: i dunno wut i did to fix this...



  • I had been making changes to custom CSS all night, and then the forum just crashed when I tried to import a font for use.

    Error: invalid csrf token
        at verifytoken (/root/nodebb/node_modules/csurf/index.js:234:13)
        at csrf (/root/nodebb/node_modules/csurf/index.js:94:7)
        at Layer.handle [as handle_request] (/root/nodebb/node_modules/express/lib/r
    outer/layer.js:76:5)
        at trim_prefix (/root/nodebb/node_modules/express/lib/router/index.js:263:13
    )
        at /root/nodebb/node_modules/express/lib/router/index.js:230:9
        at Function.proto.process_params (/root/nodebb/node_modules/express/lib/rout
    er/index.js:305:12)
        at /root/nodebb/node_modules/express/lib/router/index.js:221:12
        at Function.match_layer (/root/nodebb/node_modules/express/lib/router/index.
    js:288:3)
        at next (/root/nodebb/node_modules/express/lib/router/index.js:182:10)
        at multipart (/root/nodebb/node_modules/connect-multiparty/index.js:42:27)
    Error: invalid csrf token
        at verifytoken (/root/nodebb/node_modules/csurf/index.js:234:13)
        at csrf (/root/nodebb/node_modules/csurf/index.js:94:7)
        at Layer.handle [as handle_request] (/root/nodebb/node_modules/express/lib/r
    outer/layer.js:76:5)
        at trim_prefix (/root/nodebb/node_modules/express/lib/router/index.js:263:13
    )
        at /root/nodebb/node_modules/express/lib/router/index.js:230:9
        at Function.proto.process_params (/root/nodebb/node_modules/express/lib/rout
    er/index.js:305:12)
        at /root/nodebb/node_modules/express/lib/router/index.js:221:12
        at Function.match_layer (/root/nodebb/node_modules/express/lib/router/index.
    js:288:3)
        at next (/root/nodebb/node_modules/express/lib/router/index.js:182:10)
        at multipart (/root/nodebb/node_modules/connect-multiparty/index.js:42:27)
    error: undefined
    

    Tried clearing cache & cookies to no avail.

    I tried running npm i nodebb-theme-vanilla@~0.0.137 to no avail.
    We are running the proper version of Lavender as well.

    I verified that we're connected to the Master branch, and that we're up-to-date with origin/master.

    Edit for @julian
    I just restored to a backup that is 17 hours old and the issue's persisting. Not sure what's up.
    Seems as if it's hitting an undefined error in the console whenever the board is accessed and needs to restart. I also restored to a backup running 0.5.0-4 instead of 0.5.0 and still can't start.

    The servers having this issue are in DO Amsterdam 2. Any one else experiencing this issue that can weigh in?



  • Problem is solved on latest master branch. Thanks a bunch 🙂


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 2
  • 10
  • 7
| |