This was due to a version mismatch. I was trying to use the database with a previous version of NodeBB by mistake. I'm marking this as solved
Best posts made by asdrubalivan
-
RE: [SOLVED] Getting a WRONGTYPE Operation against a key holding the wrong kind of value
-
RE: [Solved] Help with hook on getting recent topic topics
No. I just tried and it works @PitaJ. I just changed the hook and it worked. Thank you so much! This is now solved
-
[Solved] Help with hook on getting recent topic topics
Hello everyone! I have the following issue while developing a new theme for NodeBB.
We are adding upvote/downvote capability to topics from the topics list like in the following image
In order to add voting/downvoting to theme topics from the categories list like the following we added this method
library.getCategoryHook = async function(data) { const topics = data.topics; const uid = data.uid; const promises = topics.map(async (topic) => { const hasVoted = await posts.hasVoted(topic.mainPid, uid); return { ...topic, upvoted: hasVoted.upvoted, downvoted: hasVoted.downvoted, enableVoting: uid !== 0 && data.uid !== topic.uid } }); data.topics = await Promise.all(promises); return data; }
This is called using the hook
filter:category.topics.get
and it works for the topics list but if I try to go to the recent topics view, this hook is not called. Other possibility would be to load the information on page enter but I'm not sure how to do that, any suggestions?Thanks for any help
Latest posts made by asdrubalivan
-
[nodebb-plugin-emoji] Emojis are not working
Hello, we have a forum with nodebb-plugin-emoji installed but currently it's not working. We have this error on the console
Uncaught Error: Mismatched anonymous define() module: function(){return u} http://requirejs.org/docs/errors.html#mismatch F require.js:7 v require.js:14 c require.js:26 requirejs require.js:32 <anonymous> emoji-setup.js:157
On
emoji-setup.js
there's the following code that failsrequire(['emoji'], function (emoji) { $(window).on('composer:autocomplete:init chat:autocomplete:init', function (e, data) { emoji.init(); data.strategies.push(emoji.strategy); }); });
The
require
callback is not called. Any suggestions? I can give more information as requested. Also, is there a way to prevent minifying nodebb assets? This would make easier the debugging process. Thanks for any help -
RE: [Solved] Help with hook on getting recent topic topics
No. I just tried and it works @PitaJ. I just changed the hook and it worked. Thank you so much! This is now solved
-
[Solved] Help with hook on getting recent topic topics
Hello everyone! I have the following issue while developing a new theme for NodeBB.
We are adding upvote/downvote capability to topics from the topics list like in the following image
In order to add voting/downvoting to theme topics from the categories list like the following we added this method
library.getCategoryHook = async function(data) { const topics = data.topics; const uid = data.uid; const promises = topics.map(async (topic) => { const hasVoted = await posts.hasVoted(topic.mainPid, uid); return { ...topic, upvoted: hasVoted.upvoted, downvoted: hasVoted.downvoted, enableVoting: uid !== 0 && data.uid !== topic.uid } }); data.topics = await Promise.all(promises); return data; }
This is called using the hook
filter:category.topics.get
and it works for the topics list but if I try to go to the recent topics view, this hook is not called. Other possibility would be to load the information on page enter but I'm not sure how to do that, any suggestions?Thanks for any help
-
Hook for modifying session cookie
Hello! I have a community with nodebb hosted in a domain like forum.com, and a blog in a different domain called blog.com. From the blog I perform API requests to the forum using a plugin. I use
credentials: 'include'
to perform such queries. They work correctly on chrome and firefox, however I'm getting the following warning on chromeA cookie associated with a cross-site resource at http://forum.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
I've been trying using the hook
action:user.loggedIn
setting the session cookie as follows// This function is called with the hook I mentioned before Comments.onLoggedIn = function (params) { console.log('params',params, arguments) params.req.session.cookie.sameSite = "none"; // Also tried with "lax" }
but the warning doesn't disappear and in fact when I try to make queries to NodeBB's api
req.user
appearsundefined
. Note that I needreq.user
in order to make the API requests.If you have any questions or need some clarification I'm happy to post them here.
Thanks in advance
-
Hooks on build
Hello! I've been reading the code of NodeBB since I'm developing a plugin for it. Right now I have some ES6 code that needs to be transpiled to ES5 and I'm looking for a way to transpile it in the build process. Are there any hooks that can help me with this process?
Thanks in advance
-
RE: How do you unit test plugins?
I see! Thank you so much for your response!
-
How do you unit test plugins?
Hello! I need to create a plugin for a customer and I couldn't find documentation on testing. I'd like to see any examples on github that you recommend for testing plugins.
What sources do you recommend? I'd like to test the plugins using something like Jest or Mocha
-
RE: [SOLVED] Getting a WRONGTYPE Operation against a key holding the wrong kind of value
This was due to a version mismatch. I was trying to use the database with a previous version of NodeBB by mistake. I'm marking this as solved
-
RE: [SOLVED] Getting a WRONGTYPE Operation against a key holding the wrong kind of value
Strange error
node app --upgrade 23/5 15:54:06 [18375] - info: NodeBB v1.7.2 Copyright (C) 2013-2019 NodeBB Inc. 23/5 15:54:06 [18375] - info: This program comes with ABSOLUTELY NO WARRANTY. 23/5 15:54:06 [18375] - info: This is free software, and you are welcome to redistribute it under certain conditions. 23/5 15:54:06 [18375] - info: Updating NodeBB... /var/www/[redacted]/src/cli/upgrade.js:90 if (options.package || options.install || ^ TypeError: Cannot read property 'package' of undefined at Object.runUpgrade [as upgrade] (/var/www/[redacted]/src/cli/upgrade.js:90:15) at Object.<anonymous> (/var/www/[redacted]/app.js:68:31) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) at Function.Module.runMain (internal/modules/cjs/loader.js:754:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
I checked and I have a
package.json
and apackage-lock.json
file in my home directory -
RE: [SOLVED] Getting a WRONGTYPE Operation against a key holding the wrong kind of value
Did
./nodebb reset -p
to see if this has something to do with the plugins. However, after I run./nodebb upgrade
(I get a out of date schema error) I get the same error I mentioned in the first postHere's the log
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. For the full license, please visit: http://www.gnu.org/copyleft/gpl.html Clustering enabled: Spinning up 1 process(es). 23/5 15:25:13 [17973] - info: Initializing NodeBB v1.7.2 http://127.0.0.1:4567 23/5 15:25:15 [17973] - error: Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec: 23/5 15:25:15 [17973] - error: ./nodebb upgrade [cluster] Child Process (17973) has exited (code: 0, signal: null)
Then after the creation of the Global moderators group, this occurs
Error occurred Error occurred during upgrade /var/www/[redacted]/src/cli/upgrade.js:68 throw err; ^ ReplyError: WRONGTYPE Operation against a key holding the wrong kind of value