diff --git a/.changelog/3800.txt b/.changelog/3800.txt new file mode 100644 index 0000000000..f181f5fcf5 --- /dev/null +++ b/.changelog/3800.txt @@ -0,0 +1,3 @@ +```release-note:bug +Fixed crash due to nil context when loading credentials +``` diff --git a/google-beta/config.go b/google-beta/config.go index e8f51012f9..cf5a5eaec3 100644 --- a/google-beta/config.go +++ b/google-beta/config.go @@ -314,6 +314,8 @@ func (c *Config) LoadAndValidate(ctx context.Context) error { c.Scopes = DefaultClientScopes } + c.context = ctx + tokenSource, err := c.getTokenSource(c.Scopes) if err != nil { return err @@ -345,7 +347,6 @@ func (c *Config) LoadAndValidate(ctx context.Context) error { userAgent := fmt.Sprintf("%s %s", tfUserAgent, providerVersion) c.client = client - c.context = ctx c.userAgent = userAgent // This base path and some others below need the version and possibly more of the path