clairvoyance
clairvoyance copied to clipboard
Improve error handling
When url is set as a parameter that hasn't graphql, we get the following error:
2024-08-24 01:42:11 WARNING | Error posting to https://somewebsite/: Expecting value: line 1 column 1 (char 0)
Which is implicit. I think that proper error handling should be in place and we might tell to the user that URL might be incorrect or there is another issue (based on possibilities). It will make program "smarter".
Additionally, in case if URI without path is set, we might suggest to use different tool to discover GraphQL endpoints.
For now,
If you are seeing json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
, then, please, make sure that it's the issue on Clairvoyance side and not: auth error, rate limiting, server WAF, server header/IP requirements or other server-related issue.
Draft of a troubleshooting guide
List of potential reasons of "Retrieved non-JSON response from ..."
- Invalid URI: check that endpoint is set correctly (TODO: if no GraphQL detected on endpoint, stop exec with appropriate message)
- Auth Error: make sure that cookies and authentication headers are set the same as in browser or other place that is able to connect with GraphQL endpoint; sometimes IP might play a role in it as well
- Rate Limiting: if Clairvoyance was executing fine before the error, it might be due to rate limiting. Lower amount of threads or try to run the program in a slow mode
- WAF: server doesn't allow requests due to bad user-agent or other reason. See auth error for details on fix.
- Ban: your IP/fingerprint might've been banned by some sensitive IPS, you can try to circumvent block by changing your IP and other parameters
- Server-related issue: server might be temporary unavailable, check the endpoint manually using browser or other previously used tools