Error: invalid csrf token[resolved]

Bug Reports
  • Though it is not a bug but some authentication problems with some plugin due to which they throw Error: invalid csrf token. I want to know in general which kind of issue within the plugins causes this error. And how to go about fixing this error.

  • @vatsal more context...It is happening while I am trying to upload the image through nodebb-plugin-imgur https://github.com/barisusakli/nodebb-plugin-imgur. As soon as I hit the "open" button from my browser file picker, I get this error inside my nodejs console log: (running in dev mode)

    Error: invalid csrf token
    at verifytoken (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/csurf/index.js:234:13)
    at csrf (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/csurf/index.js:94:7)
    at Layer.handle [as handle_request] (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/layer.js:76:5)
    at next (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/route.js:100:13)
    at Route.dispatch (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/route.js:81:3)
    at Layer.handle [as handle_request] (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/layer.js:76:5)
    at /Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:234:24
    at Function.proto.process_params (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:312:12)
    at /Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:228:12
    at Function.match_layer (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:295:3)
    
  • @vatsal Can you let us know your NodeBB and imgur plugin versions?

  • @julian said:

    Can you let us know your NodeBB and imgur plugin versions?

    i have the same error, my forum is down after that

    i have You are running NodeBB v0.5.2-dev. and imgur last version 😟

    edit :

    upload-e1618fd9-838b-4515-8f31-eedf2bf80902

  • @ffmad, this is part of the reason it's never a good idea to run dev builds in production. You should pull from the v0.5.x branch.

  • @Ted said:

    @ffmad, this is part of the reason it's never a good idea to run dev builds in production. You should pull from the v0.5.x branch.

    the v.0.5.x branch wasn't working at all compared to this dev version

  • upgrading to the latest version of nodebb-theme-lavender fixed this issue

  • @ffmad there had been a bad commit pushed a while back, but I've done a few pulls from v0.5.x and they've all been stable.
    @vatsal, good to hear that you resolved the matter.


Suggested Topics


  • 0 Votes
    3 Posts
    1k Views

    thanks - this seems to be an error for a particular user. The only thing different about that user is that it was imported, and I changed the email directly in the DB (mongo) after import.

    I've tried running nodebb in debugging mode but nothing appears in the logs when I try to reset the password for that user.

  • search error

    Bug Reports
    1
    0 Votes
    1 Posts
    852 Views

    when I do a search for a word Create I get the following error.

    22/9 16:28 [18998] - error: [plugins] filter:search.query, Unable to execute query: error processing query: ns=0.searchpost limit=20 skip=0 Tree: TEXT : query=welt, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query 22/9 16:28 [18998] - error: /api/search/welt MongoError: Unable to execute query: error processing query: ns=0.searchpost limit=20 skip=0 Tree: TEXT : query=welt, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query at Function.MongoError.create (/var/www/clients/16/28/web/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:31:11) at queryCallback (/var/www/clients/16/28/web/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:267:34) at Callbacks.emit (/var/www/clients/16/28/web/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:95:3) at null.messageHandler (/var/www/clients/16/28/web/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:243:23) at Socket.<anonymous> (/var/www/clients/16/28/web/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:262:22) at Socket.emit (events.js:95:17) at Socket.<anonymous> (_stream_readable.js:748:14) at Socket.emit (events.js:92:17) at emitReadable_ (_stream_readable.js:410:10) at emitReadable (_stream_readable.js:406:5) 22/9 16:28 [18998] - error: [plugins] filter:search.query, Unable to execute query: error processing query: ns=0.searchtopic limit=20 skip=0 Tree: TEXT : query=welt, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query

    Title and posts Search does not work

    People search works ok.

  • 0 Votes
    16 Posts
    4k Views

    @Lingyong-Zhang said:

    @baris I see, my site use the mongodb , 1 core/1G VPS, but it alway go wrong

    previous , I use the redis , but now I use the mongodb. I don't know which is good

  • _csrf error

    Bug Reports
    20
    0 Votes
    20 Posts
    5k Views

    @psychobunny That's done the trick, no csrf error when enabling emoji-extended. 👍

  • Category permission errors

    Bug Reports
    3
    0 Votes
    3 Posts
    1k Views