Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirectiveLocation not found on CraftQL 1.3.3 #312

Closed
minyan-gu opened this issue Aug 29, 2019 · 8 comments
Closed

DirectiveLocation not found on CraftQL 1.3.3 #312

minyan-gu opened this issue Aug 29, 2019 · 8 comments

Comments

@minyan-gu
Copy link

minyan-gu commented Aug 29, 2019

After upgrading to 1.3.3, experiencing below error inside CraftQL's graphiql editor. There is no schema generated and can not run any queries.

This issue appears on both Craft CMS 3.2 and 3.3 version. Rolling back CraftQL to 1.3.2 with webonyx/graphql-php (v0.11.6), then everything works as usual.

{
  "error": "Class 'GraphQL\\Type\\Definition\\DirectiveLocation' not found"
}

Environments:
CraftQL version: 1.3.3
Craft CMS version: 3.3 & 3.2
PHP version: 7.2
webonyx/graphql-php: v0.12.6

@narration-sd
Copy link
Contributor

narration-sd commented Aug 29, 2019

Yes, just checked, and I'm getting that also - something needs to catch up, or is in progress on the Craft GraphQL graphiql side. I know Andris is working there.

In the mean time, you could try using Insomnia, https://insomnia.rest -- once you get the hang of its UX, it feels here at least a much nicer tool for things you'd do with internal graphiql, and I just checked it's working fine with 3.3 including the webonyx upgrade, as expected..

For confidence also, on a complex app I'm in the moment of developing, CraftQL itself in 3.3 latest is working well.

As a hint for Andris to fix, I got this unexpected error myself a few hours ago, from a fault during own development. I believe the issue was sending a query that was malformed in an unusual way, though it didn't have Directives at all, but not sure of that. Anyway, he'll find the issue, to be sure.

@narration-sd
Copy link
Contributor

Well, there's more to this -- I believe you're correct to think so, @minyangu-bgl .

When I try CraftQL's service directly inside of latest Craft 3.3, I get this error. And the same from outside attaching directly to CraffQL via Insomnia.

Tracing a bit, I find there are Php type mismatches.

In the Date directive code is the immediate cause of this error, needing a different source for defining DirectiveLocation:

So I made this change in vendor\markhuot\craftql\src\Directives\Date.php

// use GraphQL\Type\Definition\DirectiveLocation;
use GraphQL\Language\DirectiveLocation;

But after this possible repair, I get more Php errors, showing up in PhpStorm's xdebug console:

PHP Notice: Undefined index: query:entryType:4 in /home/vagrant/lv-ngatsby/vendor/markhuot/craftql/src/Models/Token.php on line 70
PHP Notice: Undefined index: query:entryType:4 in /home/vagrant/lv-ngatsby/vendor/markhuot/craftql/src/Models/Token.php on line 70
PHP Fatal error: Declaration of markhuot\CraftQL\Types\Timestamp::parseLiteral($valueNode) must be compatible with GraphQL\Type\Definition\LeafType::parseLiteral($valueNode, ?array $variables = NULL) in /home/vagrant/lv-ngatsby/vendor/markhuot/craftql/src/Types/Timestamp.php on line 0

composer.lock says the following, so i believe I'm truly on versions that are supposed to work:

"webonyx/graphql-php": "^0.12.0",
and
"name": "markhuot/craftql",
            "version": "1.3.3",

But these don't appear actually to be compatible, by tests and error messages above.

Next ideas to come, I think, from @brandonkelly ??

@jrtderonde
Copy link

Same error here

@rluijten
Copy link

+1

@brandonkelly
Copy link
Collaborator

v1.3.4 is out now with a fix for this. Sorry for the trouble!

@narration-sd
Copy link
Contributor

Great stuff, @brandonkelly -- woke up after too-late engagement with Latvia and others, updated, and Live Vue now appears to prove out as ambidextrous with the two GraphQL flavors. Moving on...

@narration-sd
Copy link
Contributor

narration-sd commented Aug 29, 2019

Hmm, looked at what you did, @brandonkelly, and I was half-way there, and aware of the other; just too late to go further in case there were more involved version issues present.

What seemed unusual to me is that the second error, for the argument list mismatch, didn't show up in a php-errors.log, which I think we may not have anymore, nor in web.log.

Might have to do with xdebug having been in there, but do you know more?

@minyan-gu
Copy link
Author

1.3.4 works like a charm, thanks @brandonkelly for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants