3.3.0 Upgrade Support
-
@baris It can be successful here. On my site, a breakpoint error is reported in fetch, which seems to be the reason for packaging.
I replaced fetch with $.ajax and restored
async function xhr(options, cb) { // Allow options to be modified by plugins, etc. ({ options } = await fireHook('filter:api.options', { options })); $.ajax(options) .done((res) => { cb(null, ( res && res.hasOwnProperty('status') && res.hasOwnProperty('response') ? res.response : (res || {}) )); }) .fail((ev) => { let errMessage; if (ev.responseJSON) { errMessage = ev.responseJSON.status && ev.responseJSON.status.message ? ev.responseJSON.status.message : ev.responseJSON.error; } cb(new Error(errMessage || ev.statusText)); }); }
-
@陈洁 Looks like you modified the code and added try/catch around the fetch which is causing the
res
variable to be undefined further down the code.It should be
const res = await fetch(url, options); const { headers } = res; const contentType = headers.get('content-type'); const isJSON = contentType && contentType.startsWith('application/json'); let response; if (isJSON) { response = await res.json(); } else { response = await res.text(); } if (!res.ok) { return cb(new Error(isJSON ? response.status.message : response)); }
-
@sweetp Yes but it would take some time to run the required queries in psql by hand.
I doubt nodebb would work after that though if
db.getObjects
is failing. You can try running a custom script to see if it fails for everything or just for these message objects.Place the below code in your nodebb folder and run it with
node custom_script.js
/* eslint-disable no-await-in-loop */ /* globals require, console, process */ 'use strict'; const nconf = require('nconf'); nconf.file({ file: 'config.json', }); nconf.defaults({ base_dir: __dirname, views_dir: './build/public/templates', upload_path: 'public/uploads', }); const db = require('./src/database'); db.init(async (err) => { if (err) { console.log(`NodeBB could not connect to your database. Error: ${err.message}`); process.exit(); } await testDb(); console.log('done'); process.exit(); }); async function testDB() { const globalObj = await db.getObject('global'); console.log('global', globalObj); const msgs = await db.getObjects(['message:1', 'message:2', 'message:3']); // you can change the keys to the actual ones from the upgrade script console.log(msgs); }
Try running this script on 3.2.3 and 3.3.0 and see if it fails on 3.3.0 if it does it's time to use git-bisect to find which commit caused the issue.
-
@陈洁 On the register page when you enter a username it makes these requests to check if the username exists and if its available the call returns 404 status code when that happens the
contentType
is set to"text/plain; charset=utf-8"
and isJSON is set to false so it executesresponse = await res.text()
Is this not the case on your forum?
-
@baris said in 3.3.0 Upgrade Support:
node custom_script.js
this works just fine on v3.3.0...
node custom_script.js global { nextCid: 29, nextEid: 2070, nextMid: 59, nextPid: 4177, nextTid: 927, nextUid: 1482, postCount: 4094, userCount: 1350, loginCount: 1058, nextFlagId: 2, topicCount: 872, uniqueIPCount: 137434, nextChatRoomId: 16, nextTopicEventId: 24 } [ { ip: '45.18.15.217', roomId: 3, content: 'In cookie 5 it says to go to system preference/security & privacy/ and click on full disk access and the check the box next to cookies. I am using Mojave current edition but when I go there it has smbd and sushi but nothing about cookie5. can you help. I downloaded this from the App Store.', deleted: 0, fromuid: 505, timestamp: 1546640245770 }, { ip: '88.202.177.201', roomId: 3, content: 'Hi Frank, if you open up you Applications folder. you can drag the Cookie 5 icon into that System Preferences window', deleted: 0, fromuid: 2, timestamp: 1546648541667 }, { ip: '144.2.74.202', roomId: 5, content: 'Ich bekomme immer wieder Aufforderungen von Adobe, meinen Flashplayer upzudaten, obwohl ich die neueste Version installiert habe. Ich vermute, dass hat mit Cookie zu tun. Was muss einstellen, damit Adobe Ruhe gibt?', deleted: 0, fromuid: 412, timestamp: 1560601654538 } ] done
-
-
@baris said in 3.3.0 Upgrade Support:
You could try adding
.allowDiskUse(true)
to the query at https://github.com/NodeBB/NodeBB/blob/master/src/database/mongo/sorted.js#L397-L401.It throws that error because the data is too big to sort in memory (the default limit is 100mb).
I am working on the new upgrade script that should be aviable later today as 3.3.1.
Hello @baris . Today after update to 3.3.1 I see a new error:
Parsing upgrade scripts... OK | 5 script(s) found, 124 skipped → [2023/7/2] Update chat messages to add roomId field... Error occurred 2023-08-18T19:43:48.782Z [4567/9] - warn: NodeBB Setup Aborted. TypeError: midsSeen.hasOwnProperty is not a function at /usr/src/app/nodebb/src/upgrades/3.3.0/chat_room_refactor.js:41:55 at Array.filter (<anonymous>) at batch.processSortedSet.batch (/usr/src/app/nodebb/src/upgrades/3.3.0/chat_room_refactor.js:41:31) at module.processSortedSet (/usr/src/app/nodebb/src/database/mongo/sorted.js:588:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async exports.processSortedSet (/usr/src/app/nodebb/src/batch.js:30:10) at async batch.processSortedSet.batch (/usr/src/app/nodebb/src/upgrades/3.3.0/chat_room_refactor.js:40:8) at async module.processSortedSet (/usr/src/app/nodebb/src/database/mongo/sorted.js:588:5) at async exports.processSortedSet (/usr/src/app/nodebb/src/batch.js:30:10) at async batch.processArray.batch (/usr/src/app/nodebb/src/upgrades/3.3.0/chat_room_refactor.js:38:6)
Any idea how can I fix this ?
Thank you