From 7afaea4cf209e3598f9e17475643c99b961c23c2 Mon Sep 17 00:00:00 2001 From: xiaozhu36 Date: Wed, 20 Oct 2021 16:05:00 +0800 Subject: [PATCH] backend/oss: Fixes the nil pointer panic error when missing access key or secret key --- internal/backend/remote-state/oss/backend.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/backend/remote-state/oss/backend.go b/internal/backend/remote-state/oss/backend.go index de08af37d..79534ed22 100644 --- a/internal/backend/remote-state/oss/backend.go +++ b/internal/backend/remote-state/oss/backend.go @@ -319,7 +319,10 @@ func (b *Backend) configure(ctx context.Context) error { } if endpoint == "" { - endpointsResponse, _ := b.getOSSEndpointByRegion(accessKey, secretKey, securityToken, region) + endpointsResponse, err := b.getOSSEndpointByRegion(accessKey, secretKey, securityToken, region) + if err != nil { + return err + } for _, endpointItem := range endpointsResponse.Endpoints.Endpoint { if endpointItem.Type == "openAPI" { endpoint = endpointItem.Endpoint