Object #<Object> has no method 'indexOf'



  • Hi.. my v.0.9.x start to throw some errors on some recent topics. as show below:

    Its not related to any plugin and i saw that this kind of error started when i changed to 0.9.x

    17/11 11:51 [14172] - error: TypeError: Object #<Object> has no method 'indexOf'
    at async.waterfall.data.privileges (/home/forum/NodeBB/src/controllers/topics.js:177:19)
    at fn (/home/forum/NodeBB/node_modules/async/lib/async.js:717:34)
    at /home/forum/NodeBB/node_modules/async/lib/async.js:1170:16
    at /home/forum/NodeBB/node_modules/async/lib/async.js:172:37
    at /home/forum/NodeBB/node_modules/async/lib/async.js:677:43
    at /home/forum/NodeBB/node_modules/async/lib/async.js:173:37
    at Object._onImmediate (/home/forum/NodeBB/node_modules/async/lib/async.js:1163:34)
    at processImmediate [as _immediateCallback] (timers.js:363:15)
    TypeError: Object #<Object> has no method 'indexOf'
    at async.waterfall.data.privileges (/home/forum/NodeBB/src/controllers/topics.js:177:19)
    at fn (/home/forum/NodeBB/node_modules/async/lib/async.js:717:34)
    at /home/forum/NodeBB/node_modules/async/lib/async.js:1170:16
    at /home/forum/NodeBB/node_modules/async/lib/async.js:172:37
    at /home/forum/NodeBB/node_modules/async/lib/async.js:677:43
    at /home/forum/NodeBB/node_modules/async/lib/async.js:173:37
    at Object._onImmediate (/home/forum/NodeBB/node_modules/async/lib/async.js:1163:34)
    at processImmediate [as _immediateCallback] (timers.js:363:15)

  • Admin

    What git hash are you on?



  • Seems like topic titles with Á É é á are crashing..

    My last git log entry:

    commit cee3918e9b8096e421933678178ddfe4e3b71adf
    Author: Julian Lam <julian@designcreateplay.com>
    Date:   Sun Nov 8 11:57:18 2015 -0500
    
    fixing crash on settings save

  • Admin

    I will take a look.


  • Admin

    @Leonardo-Galani Can you do me a favor and add the below code in src/controllers/topics.js

    console.log(ogImageUrl, topicData.thumb);
    

    Add it at line 176 and let me know the output of the log after you get the crash.



  • @baris The output is this (just before* the crash)

      { email: 'oscar_correiaj@hotmail.com' } undefined
    

    on another post:

    { email: 'katalifer@gmail.com' } undefined

  • Admin

    Looks like ogImageUrl is set to an object where it should just be a string. Do you have a profile image plugin or something? I'm guessing a plugin is setting postAtIndex.user.picture to { email: 'katalifer@gmail.com' } which is causing the crash.



  • @baris
    No, im not using any avatar profile img plugin...

    Those are the ones installed and running:

     - nodebb-widget-essentials
     - nodebb-plugin-cards
     - nodebb-plugin-composer-default
     - nodebb-plugin-dbsearch
     - nodebb-plugin-desktop-notifications
     - nodebb-plugin-emailer-mailgun
     - nodebb-plugin-google-analytics
     - nodebb-plugin-markdown
     - nodebb-plugin-recent-cards
     - nodebb-plugin-rss
     - nodebb-plugin-soundpack-default
     - nodebb-plugin-spoilers
     - nodebb-plugin-sso-google
     - nodebb-rewards-essentials
     - nodebb-plugin-sso-facebook
     - nodebb-plugin-mentions
     - nodebb-plugin-custom-pages

  • Admin

    In that case can you change the console.log to console.log(ogImageUrl, postAtIndex); and post the log when it crashes.



  • @baris

    { email: 'oscar_correiaj@hotmail.com' } { _key: undefined,
      pid: 931,
      uid: 466,
      tid: 286,
      content: '<ul>\n<li>O plano não funciona, o planejamento sim, os projetos hoje em dia não permitem que fiquemos apenas na divagação de “fazer planos”, que na maioria dos casos não serão implementadas. Tudo começa pela definição dos objetivos que não..........,
      timestamp: 1447772189409,
      reputation: 0,
      votes: 0,
      editor: null,
      edited: 0,
      deleted: false,
      relativeTime: '2015-11-17T14:56:29.409Z',
      relativeEditTime: '',
      index: 0,
      user:
        { _key: undefined,
          username: 'Oscar Correia',
          userslug: 'oscar-correia',
          email: undefined,
          picture: { email: 'oscar_correiaj@hotmail.com' },
          fullname: '',
          signature: '',
          uploadedpicture: undefined,
          reputation: -3,
          postcount: 9,
          banned: false,
     ..... },
       favourited: false,
       upvoted: false,
       downvoted: false,
       selfPost: false,
       display_moderator_tools: true,
       display_move_tools: false }

  • Admin

    @Leonardo-Galani said:

    picture: { email: 'oscar_correiaj@hotmail.com' },

    Shouldn't be an object, not sure why it's set to one though.

    Run grep -R "filter:user.getPicture" node_modules/ in your nodebb folder and see if there are any matches.



  • @baris

    No matches 😕


  • Admin

    Then I am officially out of ideas, you can set those users picture and uploaded picture property to an empty string through mongodb, and let them set their picture again.

    See if that helps. I also added a check on master that should prevent the crash, but it still doesn't explain the issue of the picture property being an object.


  • Global Moderator

    @baris Maybe it's an SSO issue? Something like the SSO is returning an object for the image instead of a link to the image?


  • Admin

    @pitaj Yeah that makes sense I checked the sso-facebook and google plugins, they are saving the picture field but there are no checks if the data is a string or object.

    https://github.com/julianlam/nodebb-plugin-sso-google/blob/master/library.js#L120-L123


  • Global Moderator

    @baris yeah I'm thinking it's Facebook since the given email is a hotmail address.



  • He used to have a image ( this user ) .. i will try to add something and delete to check it.



  • @Leonardo-Galani YEP... avatar removed.. and post now working fine...


Log in to reply
 


Star

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.