-
Notifications
You must be signed in to change notification settings - Fork 92
Description
When starting an http endpoint, the program hangs (seems indefinitely) if the token is invalid or does not exists.
At first I thought simply checking if the environment variable exists and that it has a value would resolve the issue. However, this was not the case.
I understand that the Connect
func blocks until success but shouldn't it also return an error? In this case, the ngrok service should at least return an authentication error.
// Connect begins a new ngrok [Session] by connecting to the ngrok service,
// retrying transient failures if they occur.
//
// Connect blocks until the session is successfully established or fails with
// an error that will not be retried. Customize session connection behavior
// with [ConnectOption] arguments.
func Connect(ctx context.Context, opts ...ConnectOption) (Session, error) {
Whether or not this is expected behaviour (for it to hang), I want to believe that where an attempt to start an http endpoint fails due to a missing or invalid token. The most appropriate one of the following errors should be returned to the user: ERR_NGROK_105, ERR_NGROK_106 or ERR_NGROK_107. This would give the user enough feedback for them to make any necessary changes.
This can be reproduced by following the instructions exactly as seen in the Quickstart example found in the README with or without the example token.
This library is really awesome and useful. I just decided to test it out and realise this problem. If I am missing something, it would be great if I could be pointed in the right direction. Otherwise, I will continue to familiarise myself with the code base to potentially open a PR with a fix (assuming no one would have already done so).
Similar issue but includes the error: #107