verbb / navigation

A Craft CMS plugin to create navigation menus for your site.
Other
90 stars 23 forks source link

Navigation not enabled for site: default #255

Closed knynkwl closed 2 years ago

knynkwl commented 3 years ago

Description We recently updated:

Craft 3.4.24 -> 3.6.11 Navigation 1.3.20 -> 1.4.13

We are currently not able to access our old Navigation items, as it throws the error:

Page Not Found
Navigation not enabled for site: default

I noticed going through the yaml files, that all the navigations are missing some data.

Here is a navigation I created after the upgrade (works as intended):

handle: aihaUniversitySidebarNavigation
instructions: ''
maxNodes: ''
name: 'AIHA University Sidebar Navigation'
permissions:
  craft\elements\Asset:
    enabled: '1'
    permissions: '*'
  craft\elements\Category:
    enabled: '1'
    permissions: '*'
  craft\elements\Entry:
    enabled: '1'
    permissions: '*'
  craft\elements\Tag:
    enabled: ''
    permissions: '*'
  custom:
    enabled: '1'
  verbb\navigation\nodetypes\PassiveType:
    enabled: ''
  verbb\navigation\nodetypes\SiteType:
    enabled: ''
propagateNodes: false
siteSettings:
  49e3d086-5193-4125-b091-3e1532bd4730: # AIHA
    enabled: '1'
sortOrder: 96
structure:
  maxLevels: null
  uid: ff26d134-b622-4e2f-9a3e-e310f970c54e

Here is an example of the previous navigation items:

handle: advertisingSponsorships
instructions: ''
name: Advertising/Sponsorships
propagateNodes: false
sortOrder: 12
structure:
  maxLevels: null
  uid: b2767e73-4198-4837-aa20-f64a8d857a02

Should I just fill in all the missing data, or maybe just siteSettings?

Additional info

knynkwl commented 3 years ago

Also, when I enable a navigation item for one site, I still get this error. It seems like it needs to be enabled for the default site in order for it to work at all.

engram-design commented 3 years ago

Re-saving the navigation should kick those settings into gear. There's supposed to be backward-compatibility handling if the permissions and siteSettings columns in the navigation_navs are NULL (not an empty array). If that's the case, then all sites should be enabled.

I wouldn't recommend adding the missing data manually, instead re-saving all navigations.

As for still getting the error when you enable just one site - do you mean you've picked a site from "Site Settings" in the navigation settings, and you're getting that error? You should certainly be able to enable a single site, even if not the default/primary one, and that seems to work for me.

cmalven commented 2 years ago

We ran into the same issue, and resaving each navigation wasn't enough to fix the issue. For one of our navigations, we had to manually uncheck a Permissions item (Entries, for instance), save, then recheck and resave. This seems to have forced the project config to update and now the navigation is accessible again.

engram-design commented 2 years ago

I would also suggest trying a ./craft project-config/rebuild to build the Yaml files again from the database in case they're not getting generated.