Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewHubWithNamespaceNameAndEnvironment hangs when expected env vars aren't provided #230

Open
colmsnowplow opened this issue Jul 21, 2021 · 0 comments

Comments

@colmsnowplow
Copy link

Expected Behavior

When no valid combination of env vars are provided, I expect this method to throw an error.

Actual Behavior

When none of the env vars to authenticate (eg EVENTHUB_KEY_NAME, EVENTHUB_KEY_VALUE) are provided - or one is missing - the program will just hangs indefinitely.

Handling this is a bit of an inconvenience since there are quite a few possible combinations of env vars that can be used to authenticate.

I have also noticed that it'll hang when you set EVENTHUB_CONNECTION_STRING to a value that isn't a valid format for connection string - but not when a fake value of the correct format is supplied.

It won't hang if you provide a valid set of env vars, but they're fake values.

I haven't tested this with the other NewHub methods, but I presume the same will happen for anything that uses env vars.

repro:

package main

import (
	"fmt"
	"os"

	eventhub "github.com/Azure/azure-event-hubs-go/v3"
)

func main() {

	os.Unsetenv("EVENTHUB_KEY_NAME")
	os.Unsetenv("EVENTHUB_KEY_VALUE")

	os.Unsetenv("EVENTHUB_CONNECTION_STRING")

	os.Unsetenv("AZURE_TENANT_ID")
	os.Unsetenv("AZURE_CLIENT_ID")

	os.Unsetenv("AZURE_CLIENT_SECRET")

	os.Unsetenv("AZURE_CERTIFICATE_PATH")
	os.Unsetenv("AZURE_CERTIFICATE_PASSWORD")

	hub, err := eventhub.NewHubWithNamespaceNameAndEnvironment("EventHubNamespace", "EventHubName")

	fmt.Println(err)
	fmt.Println(hub)

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant