333mmm333
07/17/2025, 4:50 PMgolang
func NewApifyProxyClientFromEnv() (*ApifyProxyClient, error) {
hostname := os.Getenv("APIFY_PROXY_HOSTNAME")
port := os.Getenv("APIFY_PROXY_PORT")
password := os.Getenv("APIFY_PROXY_PASSWORD")
// Dump all environment variables for debugging
proxyClientLog.Debug("Dumping all environment variables:")
for _, env := range os.Environ() {
if strings.Contains(env, "APIFY_PROXY_PASSWORD") {
proxyClientLog.Debugf(" %s=********", strings.SplitN(env, "=", 2)[0])
} else {
proxyClientLog.Debugf(" %s", env)
}
}
if hostname == "" || port == "" || password == "" {
return nil, fmt.Errorf("APIFY_PROXY_HOSTNAME, APIFY_PROXY_PORT, or APIFY_PROXY_PASSWORD environment variables not set")
}
groups := []string{"BUYPROXIES94952"}
if groupsStr := os.Getenv("APIFY_PROXY_GROUPS"); groupsStr != "" {
groups = strings.Split(groupsStr, ",")
}
return NewApifyProxyClient(hostname, port, password, groups, "", ""), nil // Pass empty strings for session and country
}
INFO[2025-07-17T16:34:52Z] Assigned session-specific proxy groups-BUYPROXIES98951,session-global_pool_session_0:*********@10.0.47.64:8011 to session global-pool-session-0
I'm not sure what is wrong, this is beeing run inside the apify containers, i've checked that the envs are correct and tested using a simpler session name. i always get :
WARNING[2025-07-17T16:43:59Z] Worker: Request via proxy 10.0.90.88:8011 failed with status 403 (attempt 1/3). Retrying... component=httpclientAnswer Overflow
07/17/2025, 4:50 PM333mmm333
07/17/2025, 7:27 PM