Problems after upgrading forum
-
Hi,
I have recently upgraded from 1.5.1 to 1.7.4, for the most part everything went well, however I seem to have lost all the menu items on the navigation bar, except for the collections icon.
I checked in the Admin area and when I try to select General > Navigation the following error occurs and the server restarts:
2018-02-15T15:50:02.456Z [31809] - error: TypeError: Cannot set property 'index' of undefined
at /opt/forum/src/controllers/admin/navigation.js:13:19
at Array.forEach (<anonymous>)
at /opt/forum/src/controllers/admin/navigation.js:12:17
at nextTask (/opt/forum/node_modules/async/dist/async.js:5310:14)
at next (/opt/forum/node_modules/async/dist/async.js:5317:9)
at /opt/forum/node_modules/async/dist/async.js:958:16
at /opt/forum/node_modules/async/dist/async.js:3874:9
at /opt/forum/node_modules/async/dist/async.js:473:16
at iterateeCallback (/opt/forum/node_modules/async/dist/async.js:980:24)
at /opt/forum/node_modules/async/dist/async.js:958:16
at /opt/forum/node_modules/async/dist/async.js:3871:13
at /opt/forum/node_modules/async/dist/async.js:473:16
at next (/opt/forum/node_modules/async/dist/async.js:5315:29)
at /opt/forum/node_modules/async/dist/async.js:958:16
at /opt/forum/src/navigation/admin.js:60:4
at nextTask (/opt/forum/node_modules/async/dist/async.js:5310:14)Any idea what may be causing this?
My 1.5.1 build was a tar install so I created a new git clone of 1.5.1 and copied everything over, this looked as if it worked ok but after switching to 1.7.4 the menu has broken.
Many thanks
Jon
-
db.objects.find({_key: "navigation:enabled"});
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcb2"), "_key" : "navigation:enabled", "value" : "{"8":{"iconClass":"fa-navicon","route":"/home","title":"","text":"","textClass":"","id":"","enabled":"","properties":{}}}", "score" : 8 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcb1"), "_key" : "navigation:enabled", "value" : "{"7":{"iconClass":"fa-cogs","route":"/admin","title":"[[global:header.admin]]","text":"[[global:header.admin]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"adminOnly":true}}}", "score" : 7 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcb0"), "_key" : "navigation:enabled", "value" : "{"6":{"iconClass":"fa-group","route":"/groups","title":"[[global:header.groups]]","text":"[[global:header.groups]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"adminOnly":true}}}", "score" : 6 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcaf"), "_key" : "navigation:enabled", "value" : "{"5":{"iconClass":"fa-user","route":"/users","title":"[[global:header.users]]","text":"[[global:header.users]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"loggedIn":true}}}", "score" : 5 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcae"), "_key" : "navigation:enabled", "value" : "{"4":{"iconClass":"fa-fire","route":"/popular","title":"[[global:header.popular]]","text":"[[global:header.popular]]","textClass":"visible-xs-inline","id":"","enabled":"","properties":{}}}", "score" : 4 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcad"), "_key" : "navigation:enabled", "value" : "{"3":{"iconClass":"fa-tags","route":"/tags","title":"[[global:header.tags]]","text":"[[global:header.tags]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}", "score" : 3 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcac"), "_key" : "navigation:enabled", "value" : "{"2":{"iconClass":"fa-clock-o","route":"/recent","title":"[[global:header.recent]]","text":"[[global:header.recent]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"loggedIn":true}}}", "score" : 2 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcab"), "_key" : "navigation:enabled", "value" : "{"1":{"iconClass":"fa-inbox","route":"/unread","title":"[[global:header.unread]]","text":"[[global:header.unread]]","textClass":"visible-xs-inline","id":"unread-count","enabled":"true","properties":{"loggedIn":true}}}", "score" : 1 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcaa"), "_key" : "navigation:enabled", "value" : "{"0":{"iconClass":"fa-list","route":"/categories","title":"Forums","text":"Forums","textClass":"","id":"","enabled":"true","properties":{}}}", "score" : 0 } -
-
@baris Here is the console output after adding that line:
[ { iconClass: 'fa-list',
route: '/categories',
title: 'Forums',
text: 'Forums',
textClass: '',
id: '',
enabled: 'true',
properties: {} },
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined ] -
I noticed the db query you ran only returned 9 navigation elements but the console.log you added returned an array of 10 elements. So there is something else going on. The above
console.log
will tell us more. Does the first query still return 9 elements? -
Here is the additional log output, I think I can see the issue here, is it possible I have two entries from the /categories menu both with the index of 0?
[ '{"0":{"iconClass":"fa-list","route":"/categories","title":"Forums","text":"Forums","textClass":"","id":"","enabled":"true","properties":{}}}',
'{"0":{"iconClass":"fa-list","route":"/categories","title":"[[global:header.categories]]","text":"[[global:header.categories]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}',
'{"1":{"iconClass":"fa-inbox","route":"/unread","title":"[[global:header.unread]]","text":"[[global:header.unread]]","textClass":"visible-xs-inline","id":"unread-count","enabled":"true","properties":{"loggedIn":true}}}',
'{"2":{"iconClass":"fa-clock-o","route":"/recent","title":"[[global:header.recent]]","text":"[[global:header.recent]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"loggedIn":true}}}',
'{"3":{"iconClass":"fa-tags","route":"/tags","title":"[[global:header.tags]]","text":"[[global:header.tags]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}',
'{"4":{"iconClass":"fa-fire","route":"/popular","title":"[[global:header.popular]]","text":"[[global:header.popular]]","textClass":"visible-xs-inline","id":"","enabled":"","properties":{}}}',
'{"5":{"iconClass":"fa-user","route":"/users","title":"[[global:header.users]]","text":"[[global:header.users]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"loggedIn":true}}}',
'{"6":{"iconClass":"fa-group","route":"/groups","title":"[[global:header.groups]]","text":"[[global:header.groups]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"adminOnly":true}}}',
'{"7":{"iconClass":"fa-cogs","route":"/admin","title":"[[global:header.admin]]","text":"[[global:header.admin]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"adminOnly":true}}}',
'{"8":{"iconClass":"fa-navicon","route":"/home","title":"","text":"","textClass":"","id":"","enabled":"","properties":{}}}' ] -
Yeah so you seem to have 2 identical nav items.
[ '{"0":{"iconClass":"fa-list","route":"/categories","title":"Forums","text":"Forums","textClass":"","id":"","enabled":"true","properties":{}}}', '{"0":{"iconClass":"fa-list","route":"/categories","title":"[[global:header.categories]]","text":"[[global:header.categories]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}',
Which is causing the issue, can you run
db.objects.find({_key: "navigation:enabled"});
again and make sure it is running on the database that your forum is using. -
Ah, sorry about that, that first command was run on the backup DB!
After running it on the correct one I get this output:
{ "_id" : ObjectId("5a78d01c4e5630d933353da6"), "_key" : "navigation:enabled", "value" : "{"8":{"iconClass":"fa-navicon","route":"/home","title":"","text":"","textClass":"","id":"","enabled":"","properties":{}}}", "score" : 8 }
{ "_id" : ObjectId("5a78d01c4e5630d933353da5"), "_key" : "navigation:enabled", "value" : "{"7":{"iconClass":"fa-cogs","route":"/admin","title":"[[global:header.admin]]","text":"[[global:header.admin]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"adminOnly":true}}}", "score" : 7 }
{ "_id" : ObjectId("5a78d01c4e5630d933353da4"), "_key" : "navigation:enabled", "value" : "{"6":{"iconClass":"fa-group","route":"/groups","title":"[[global:header.groups]]","text":"[[global:header.groups]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"adminOnly":true}}}", "score" : 6 }
{ "_id" : ObjectId("5a78d01c4e5630d933353da3"), "_key" : "navigation:enabled", "value" : "{"5":{"iconClass":"fa-user","route":"/users","title":"[[global:header.users]]","text":"[[global:header.users]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"loggedIn":true}}}", "score" : 5 }
{ "_id" : ObjectId("5a78d01c4e5630d933353da2"), "_key" : "navigation:enabled", "value" : "{"4":{"iconClass":"fa-fire","route":"/popular","title":"[[global:header.popular]]","text":"[[global:header.popular]]","textClass":"visible-xs-inline","id":"","enabled":"","properties":{}}}", "score" : 4 }
{ "_id" : ObjectId("5a78d01c4e5630d933353da1"), "_key" : "navigation:enabled", "value" : "{"3":{"iconClass":"fa-tags","route":"/tags","title":"[[global:header.tags]]","text":"[[global:header.tags]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}", "score" : 3 }
{ "_id" : ObjectId("5a78d01c4e5630d933353da0"), "_key" : "navigation:enabled", "value" : "{"2":{"iconClass":"fa-clock-o","route":"/recent","title":"[[global:header.recent]]","text":"[[global:header.recent]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{"loggedIn":true}}}", "score" : 2 }
{ "_id" : ObjectId("5a78d01c4e5630d933353d9f"), "_key" : "navigation:enabled", "value" : "{"1":{"iconClass":"fa-inbox","route":"/unread","title":"[[global:header.unread]]","text":"[[global:header.unread]]","textClass":"visible-xs-inline","id":"unread-count","enabled":"true","properties":{"loggedIn":true}}}", "score" : 1 }
{ "_id" : ObjectId("5a78d01c4e5630d933353d9e"), "_key" : "navigation:enabled", "value" : "{"0":{"iconClass":"fa-list","route":"/categories","title":"[[global:header.categories]]","text":"[[global:header.categories]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}", "score" : 0 }
{ "_id" : ObjectId("5a78ae3d4e5630d93334dcaa"), "_key" : "navigation:enabled", "value" : "{"0":{"iconClass":"fa-list","route":"/categories","title":"Forums","text":"Forums","textClass":"","id":"","enabled":"true","properties":{}}}", "score" : 0 }
So is the best solution to remove this line from the DB:
{ "_id" : ObjectId("5a78d01c4e5630d933353d9e"), "_key" : "navigation:enabled", "value" : "{"0":{"iconClass":"fa-list","route":"/categories","title":"[[global:header.categories]]","text":"[[global:header.categories]]","textClass":"visible-xs-inline","id":"","enabled":"true","properties":{}}}", "score" : 0 }