This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[GraphQL] Add information about debugging #4013
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
group: graphql | ||
title: Debugging GraphQL queries | ||
contributor_name: Atwix | ||
contributor_link: https://www.atwix.com/ | ||
--- | ||
|
||
This topic provides recommendations on how to debug GraphQL requests. | ||
|
||
## Debugging with PHPStorm and Xdebug | ||
|
||
When [using GraphiQL]({{ page.baseurl }}/graphql/index.html#how-to-access-graphql) or any other client for testing GraphQL queries, you might need to debug the request processing. | ||
You can use Xdebug for debugging the PHP execution of a GraphQL query just as you would for other HTTP requests. | ||
To start debugging, add the `?XDEBUG_SESSION_START=PHPSTORM` parameter to the endpoint URL. | ||
The following example shows how to establish a connection between Xdebug and PHPStorm IDE. | ||
|
||
``` | ||
http://<magento2-3-server>/graphql?XDEBUG_SESSION_START=PHPSTORM | ||
``` | ||
|
||
You can also enable an Xdebug connection for a particular request by setting the corresponding header parameter. | ||
|
||
``` | ||
Cookie: XDEBUG_SESSION=PHPSTORM | ||
``` | ||
|
||
As a result, Xdebug within the PHP execution attempts to make a connection to an IDE. If the IDE is listening, it will give the instructions to Xdebug about breakpoints and other relevant information. | ||
|
||
## Related Topics | ||
|
||
* [GraphQL request headers]({{ page.baseurl }}/graphql/send-request.html) | ||
* [Exception handling]({{ page.baseurl }}/graphql/develop/exceptions.html) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.