Resolving the “Hasura Console is not able to reach your Hasura CLI instance” error

I recently ran into the error shown above (Hasura console is not able to reach your Hasura CLI instance. Please ensure that your instance is running and the endpoint is configured correctly.), where the Hasura browser console was reporting that it couldn’t reach the CLI instance. I had run ‘hasura console’ from a terminal, I was using the port that the CLI instance reported, and was able to navigate and see my data – so I was certainly confused.

The short answer to the problem: while the browser console needs access to a port for presenting the UI and interacting there (port 9695 by default), it also needs to have access to the migrate API port (9693 by default) for some functionality. If you see this error, check to see that the port in question is fully exposed and available to your browser.

For some reason, Google doesn’t seem to have indexed a single instance of the exact error message given above, and I hope this can help somebody who comes across the same problem.

In my case, Hasura was running as part of my docker-compose development environment, on a remote VM that I had connected to via the VS Code SSH remote development extension. After reading through the CLI documentation in detail, the presence of the –api-port option gave a hint as to what the problem might be. Sure enough, once that default port was tunneled through to my local environment everything worked as expected.

Your setup is likely different than mine, but the steps I followed in Visual Studio Code were as follow:

  • Navigate to the PORTS tab in the panel at the bottom of the VS Code window.
  • The ports tab should be next to the terminal tab, but you may need to show it by right-clicking in that tab area and enabling the “Ports” option.
  • Once you are in the ports tab, you should see a list of tunneled ports. In my case, 9695 (the main console port) was listed, but 9693 for the migrate API was not there.
  • Click the “Add Port” button at the bottom of the list, and type “9693” into the port number or address field that appears on the bottom row.

That should be it! Even if your setup is different I hope this gives enough info to get you pointed in the right direction at least.

If I missed anything, or something else worked for you, feel free to add extra info in a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.