verbb / navigation

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

Recent update breaks GraphQL #239

Closed steveDL closed 3 years ago

steveDL commented 3 years ago

Description

Upgrade to 1.4.10 and you will get GraphQL error: Cannot query field "nodes" on type "Query".

Downgrading has fixed the issue.

Steps to reproduce

  1. Upgrade to 1.4.10
  2. try and query nodes

Additional info

engram-design commented 3 years ago

Can't seem to replicate this with a simple query using the GraphQL Explorer:

{
    nodes (navHandle: "mainMenu") {
        url
    }
}

Can you advise what query you're using, and from where you're calling it from, if not from the GraphQL Explorer?

engram-design commented 3 years ago

Any update on this?

engram-design commented 3 years ago

I should mention, this could possibly be tied up to the schema permissions introduced in 1.4.6. Can you let me know if you're using your own custom schema or just using the public schema.

If the former, you'll need to enable permissions to query nodes on your schema.

magicspon commented 3 years ago

multiple queries kills it

query MyQuery {
  sitenav: nodes(navHandle: "sitenav", level: 1) {
    title
  }
  subnav: nodes(navHandle: "subnav", level: 1) {
    title
  }
}
engram-design commented 3 years ago

@magicspon Pretty sure this might be related to Craft 3.6+ as again, I can't replicate that issue on Craft 3.5.x or 3.6.x

engram-design commented 3 years ago

I can't seem to replicate this behaviour no matter what @magicspon. But I believe the original issue for @steveDL would be permissions based, in that you need to opt-in to querying navigations, if you're using schemas.

daltonrooney commented 3 years ago

@engram-design I just upgraded to Craft 3.6.11.2 and Navigation 1.4.15 and I think I'm experiencing this too. I'm using custom schemas and I've enabled View all navigations for my schema. When I try to query a node, I get an error like:

 "debugMessage": "Tried to load an unregistered type \"primary_Node\". This can indicate both a typo in the query or an issue with the schema used.",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },

When I explicitly add my navigations to the schema, then my queries work as expected.

Edit: just for reference, adding View all forms to my schema does work as expected for Formie.

engram-design commented 3 years ago

Should be fixed for the next release. To get the fix early, change your verbb/navigation requirement in composer.json to:

"require": {
  "verbb/navigation": "dev-craft-3 as 1.4.15",
  "...": "..."
}

Then run composer update.

engram-design commented 3 years ago

Fixed in 1.4.16