fix: return error from NewClient if projectID is not set (#4299)
Co-authored-by: Christopher Wilcox <crwilcox@google.com>
diff --git a/firestore/client.go b/firestore/client.go
index 8ee1071..1b4c461 100644
--- a/firestore/client.go
+++ b/firestore/client.go
@@ -60,6 +60,9 @@
// NewClient creates a new Firestore client that uses the given project.
func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) {
+ if projectID == "" {
+ return nil, errors.New("firestore: projectID was empty")
+ }
var o []option.ClientOption
// If this environment variable is defined, configure the client to talk to the emulator.
if addr := os.Getenv("FIRESTORE_EMULATOR_HOST"); addr != "" {