How to debug GraphQL requests in Chrome DevTools
Every GraphQL request looks the same in the Network tab: POST /graphql, status 200, again and again. Here is how to find the one you care about with plain Chrome DevTools, where that stops working, and a free extension I
Every GraphQL request looks the same in the Network tab: POST /graphql, status 200, again and again. Here is how to find the one you care about with plain Chrome DevTools, where that stops working, and a free extension I built for the rest.
1. Filter the Network tab down to GraphQL
Open DevTools (F12), go to Network, and type graphql in the filter box. To hide the preflight OPTIONS requests too, filter with method:POST graphql.
Most clients send every operation to the same URL, so the list still shows one identical row per request. To tell them apart, click a row and open Payload: the request body has operationName, query and variables.
Tip: click the Size or Time column header to sort by it and spot the heavy or slow operations quickly.
2. Don't trust the 200
A GraphQL server usually answers with HTTP 200 even when the operation failed. The failure is in the body:
{
"data": { "user": null },
"errors": [{ "message": "Not authorised", "path": ["user"] }]
}
So check Preview or Response for an errors array, not just the status column. data can be partly filled in alongside errors, which is easy to miss.
3. Batched and persisted queries
- Batched requests send an array of operations in one request. The Payload shows an array, and the response is an array in the same order.
-
Persisted queries (for example Apollo's automatic persisted queries) often send only a hash, in
extensions.persistedQuery.sha256Hash, and no query text. You'll only see the full query on the request that registers it, after a cache miss.
4. Subscriptions over WebSockets
Subscriptions using graphql-ws don't show up as normal requests. Filter the Network tab with Socket (WS), select the connection and open Messages: each next message is one subscription event, with its id matching the subscribe message that started it.
5. Replay a request
Right-click a request and choose Copy → Copy as cURL or Copy as fetch to run it again in a terminal or the console. Edit the variables in the copied body to try other inputs.
Where this gets painful
On a real app you end up opening request after request to read operationName, scrolling through WebSocket frames to follow a subscription, and copying requests out to change one variable. There's also no easy way to see a failing or slow response in the UI without changing the server.
That's why I built Wireglass, a free Chrome extension (disclosure: I'm its author). It adds a GraphQL tab to DevTools that:
- lists each operation by name, with batches split into their operations, persisted queries labelled, and subscriptions over WebSockets included;
- shows the errors in each response, not just the status;
- can show operations on a timeline, to see what ran in parallel and which request likely waited on another's data;
- opens any operation in a full client to edit and replay it, with schema autocomplete in the query and the variables;
- can mock a response per site (replace, patch, delay or fail it) to test error and loading states without touching the server.
It has no account, no analytics and no server: everything stays in your browser.
- Docs, with short videos: https://wireglass.pages.dev/devtools/traffic/
- Chrome Web Store: https://chromewebstore.google.com/detail/wireglass/dmdokojnlojcmjbaghelooolbcabkfed?utm_source=devto
If you debug GraphQL another way, I'd like to hear how in the comments.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.