All Bonsai clusters are provisioned with a randomly generated set of credentials. These must be supplied with every request in order for the request to be processed. An HTTP 401 response indicates the authentication credentials were missing from the request.
To elaborate on this, all Bonsai cluster URLs follow this format:
https://username:password@hostname.region.bonsai.io
The username and password in this URL are not the credentials used for logging in to Bonsai, but are randomly generated alphanumeric strings. So your URL might look something like:
https://kjh4k3j:lv9pngn9fs@my-awesome-cluster.us-east-1.bonsai.io
The credentials kjh4k3j:lv9pngn9fs
must be present with all requests to the cluster in order for them to be processed. This is a security precaution to protect your data (on that note, we strongly recommend keeping your full URL a secret, as anyone with the credentials can view or modify your data).
Not All APIs are Available
It's possible to get an HTTP 401 response when attempting to access one of the Unsupported API Endpoints. If you're trying to access server level tools, restart a node, etc, then the request will fail, period. Please read the documentation on unavailable APIs to determine whether the failing request is valid.
I'm including credentials and still getting a 401!
Please ensure that the credentials are correct. You can find this information on your cluster dashboard. Note that there is a tool for rotating credentials. So it's entirely possible to be using an outdated set of credentials.
Heroku users should also inspect the contents of the BONSAI_URL
config variable. This can be found in the Heroku app dashboard, or by running heroku config:get BONSAI_URL
. The contents of this variable should match the URL shown in the Bonsai cluster dashboard exactly.
If you're sure that the credentials are correct and being supplied, send us an email and we will investigate.