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

introspection: give a clear error message when introspection is maybe just disabled #187

Closed
abernix opened this issue Jan 19, 2021 · 3 comments · Fixed by #395
Closed

introspection: give a clear error message when introspection is maybe just disabled #187

abernix opened this issue Jan 19, 2021 · 3 comments · Fixed by #395
Assignees
Labels
feature 🎉 new commands, flags, functionality, and improved error messages

Comments

@abernix
Copy link
Member

abernix commented Jan 19, 2021

By default, and since it can be a best-practice for many servers, Apollo Server disables introspection in production (determined by process.env.NODE_ENV === "production"). This, coupled with the current error messaging behavior of the apollo CLI results in a sub-par user-experience for those who are trying to introspect their production server.

While I'm not sure what all the error messaging considerations are right now, we can help the user by offering "introspection might be disabled" as part of the error output if we just literally do not get any introspection response from an endpoint.

image

@abernix abernix added the feature 🎉 new commands, flags, functionality, and improved error messages label Jan 19, 2021
@abernix
Copy link
Member Author

abernix commented Jan 19, 2021

For Apollo Server specifically, which offers its own instructions on how to enable introspection, there is an HTTP status code of 400, coupled with a GraphQL ValidationError that we could match for and customize the error message for.

@lrlna lrlna added this to the 0.0.5 milestone Feb 19, 2021
@lrlna
Copy link
Member

lrlna commented Mar 29, 2021

@abernix do you have a particular endpoint I can test on that would return a 400 when introspection is disabled? I can currently get endpoints to return a 405 and am not able to replicate this exact behaviour you're describing.

@lrlna lrlna self-assigned this Mar 29, 2021
@abernix
Copy link
Member Author

abernix commented Mar 29, 2021

@lrlna Sure! Here's a CodeSandbox with Apollo Server running with introspection: false. You may have to visit that link for it to spin up prior to invoking this curl command (which is a vastly simplified "introspection-like query):

curl -vvv 'https://orekg.sse.codesandbox.io/' -H 'Content-Type: application/json' --data-binary '{"query":"{ __schema { type } }"}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants