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
deploymentKey := "<MY_DEPLOYMENT_KEY>"
// Initialize the Amplitude Experiment client
client := local.Initialize(deploymentKey, nil)
// Start the client
if err := client.Start(); err != nil {
fmt.Printf("Warning: Error starting client: %v\n", err)
return
}
// Example user for feature flag evaluation
user := &experiment.User{
UserId: "user123",
DeviceId: "device456",
UserProperties: map[string]interface{}{
"userType": "premium",
"region": "US",
},
}
// Example: Evaluate feature flags
flagKeys := []string{"new-feature-flag", "feature-1", "feature-2"}
variants, err := client.EvaluateV2(user, flagKeys)
if err != nil {
fmt.Printf("Error evaluating flags: %v\n", err)
fmt.Printf("Error type: %T\n", err)
return
}
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