Hey,
Im trying to get evaluation for a feature flag i defined and im encountering a few issues.
This is the code im trying to execute:
// Get deployment key from environment variable or use a default<br /> deploymentKey := "<MY_DEPLOYMENT_KEY>"<br /><br /><br /> // Initialize the Amplitude Experiment client<br /> client := local.Initialize(deploymentKey, nil)<br /><br /> // Start the client<br /> if err := client.Start(); err != nil {<br /> fmt.Printf("Warning: Error starting client: %v\n", err)<br /> return<br /> }<br /><br /> // Example user for feature flag evaluation<br /> user := &experiment.User{<br /> UserId: "user123",<br /> DeviceId: "device456",<br /> UserProperties: map[string]interface{}{<br /> "userType": "premium",<br /> "region": "US",<br /> },<br /> }<br /><br /> // Example: Evaluate feature flags<br /> flagKeys := []string{"new-feature-flag", "feature-1", "feature-2"}<br /> variants, err := client.EvaluateV2(user, flagKeys)<br /> if err != nil {<br /> fmt.Printf("Error evaluating flags: %v\n", err)<br /> fmt.Printf("Error type: %T\n", err)<br /> return<br /> }<br /><br /> fmt.Printf("Feature flags evaluation results:\n")
and i got the following error:
Warning: Error starting client: Get "https://api.lab.amplitude.com/sdk/v2/flags?v=0": dial tcp: lookup api.lab.amplitude.com: no such host
I than defined the client as follows:
client := local.Initialize(deploymentKey, &local.Config{
ServerZone: local.EUServerZone,
})
and got an the following error:
Failed to fetch flag configs: invalid character 'I' looking for beginning of value
After a short debugging session in the Amplitude experiment Go SDK, i discovered that the response actually return
Invalid Api-Key
Even though im definitely using the right credentials