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

YamlParsing Error while calling FindYamlByPath function in harness-go-sdk #277

Open
snp1606 opened this issue Jan 25, 2023 · 0 comments
Open

Comments

@snp1606
Copy link

snp1606 commented Jan 25, 2023

Hi Team,
I am trying to update my harness-go-sdk version from 0.1.11 to 0.3.9 and in one of our terraform module its failing on the terratest.
Below are the details . Please check the details and suggest the fix/resolution for doing the backward compatibility while upgrading the harness-go-sdk version.
I have checked the arguments passed to FindYamlByPath which are 'id' and 'path' and they are getting valid values. Please let me know if you need any further information from the code to reproduce the error.

# The line which gives error
workflowYamlItem err := client.ConfigAsCodeClient.FindYamlByPath(fmt.Sprint(applicationAttributes["id"]), cac.YamlPath(path)

# Error message :
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: nvalid memory address or nil pointer dereference

# Client Configuration for Harness

client, err := cd.NewClient(&cd.Config{
AccoundId: helpers.EnvVars.AccountId.Get(),
APIKey: helpers.EnvVars.ApiKey.Get(),
Endpoint: "https://app.harness.io/gateway",
DefaultHeader: make(map[string]string),
HTTPClient: &retryablehttp.Client{
RetryMax: 10,
RetryWaitMin: 5 * time.Second,
RetryWaitMax: 10 * time.Second,
HTTPClient: &http.client{
Timeout: 10 * time.Second,
},
Backoff: retryablehttp.DefaultBackoff,
CheckRetry: retryablehttp.DefaultRetryPolicy,
}
DebugLogging: true,
})

# imports in go.mod ( go version 1.16 )

github.com/gruntwork-io/terratest v0.40.2
github.com/harness/harness-go-sdk v0.3.9
github.com/hashicorp/go-retryablehttp v0.7.1
github.com/stretchr/testify v.1.7.1
gopkg.in/yaml.v3 v3.0.1

# Terratest imports :
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/harness/harness-go-sdk/harness/cd"
"github.com/harness/harness-go-sdk/harness/helpers"
"github.com/hashicorp/go-retryablehttp"
"github.com/harness/harness-go-sdk/harness/cd/cac"
"github.com/stretchr/testify/require"
"testing"
"os"
"encoding/json"
"fmt"
"gopkg.in/yaml.v3"
"time"
"net/http"

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