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

Gql gives 500 Internal Error vs. expected GraphQL explain on mis-spelled fragments #5016

Open
narration-sd opened this issue Sep 29, 2019 · 6 comments

Comments

@narration-sd
Copy link
Contributor

commented Sep 29, 2019

Description

A mis-formed or mis-spelled inline fragment signature gets the 500, where usually an informative GraphQL error would have been presented.

Steps to reproduce

  1. GraphQL Explore works fine for this (expand its name to Explore (GraphiQL) for simple cross-GraphQL-platform clarity??)
  2. try a simple standard Gql query that has an inline fragment, as most will:
query  {
        entries {
          id
          ...on cards_cards_Entry {
            title
          }
        }
      }
  1. Works
  2. now try mis-spelling the signature of the fragment even slightly -- or make it named as for CraftQL, or prefixed as for Gridsome's federativity, or Gatsby's apparent lean in that direction...) -- but we'll be simple here:
query  {
        entries {
          id
          ...on cards_cards_Entryy {
            title
          }
        }
      }
  1. Get a 500 Internal Server Error, with the query error 'Something went wrong when processing the GraphQL query.' message and a big stack trace.

Additional info

PHP version 7.1.28
OS version Linux 4.15.0-47-generic
Database driver & version MySQL 5.7.25
Image driver & version GD 7.1.28
Craft edition & version Craft Pro 3.3.3
Yii version 2.0.21
Twig version 2.11.3
Guzzle version 6.3.3
Imagine version 1.2.3-dev

Plugins
CraftQL 1.3.4
Element API 2.6.0
Live Vue dev-craft-gql-field-args
Redactor 2.4.0

@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Oct 7, 2019

Ah. This is a victim of the rather aggressive performance optimizations, where the entire schema is not loaded for queries that are not introspection. I'll see what I can do to alleviate this.

@narration-sd

This comment has been minimized.

Copy link
Contributor Author

commented Oct 7, 2019

nice to keep any performance enhancements -- maybe you can intercept and go back if the 500 is trying to appear, something like that? I am sure you probably thought of this already....!

@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Oct 7, 2019

It's not a HTTP 500 anymore as of Craft 3.3.6.

It's not the verbose explanation that GraphQL provides, however, because of the schema loading optimizations. Yet.

@narration-sd

This comment has been minimized.

Copy link
Contributor Author

commented Oct 7, 2019

moving fast - I'll update...enjoying the 'Yet' 🐟

@andris-sevcenko andris-sevcenko added this to the 3.4 milestone Oct 9, 2019
@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Oct 9, 2019

This will be fixed in a nice manner for 3.4.

@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Oct 9, 2019

Okay, so, if devmode enabled, you'll see the nice verbose GraphQL error messages in 3.4.

You can also customize this behavior using the appropriate event, as of 5fcc5e1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.