Context Deadline Excceded (Client.Timeout exceeded while awaiting headers) - F5 bigip

I’m currently trying to use golang to start managing some aspects of our F5 BigIPs. I found two packages to help interface with the F5s.

For both packages I’m receiving the same error when trying to make calls to the F5

Get "https://<f5-ipaddress>/mgmt/tm/ltm/virtual/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Here is the code I’m using for both packages.

package main

import (
        "fmt"
        "github.com/e-XpertSolutions/f5-rest-client/f5"
        "github.com/e-XpertSolutions/f5-rest-client/f5/ltm"
        "github.com/scottdware/go-bigip"
)

func main() {
        f5Client, err := f5.NewBasicClient("https://<f5-ipaddress>", "username", "password")
        if err != nil {
                fmt.Println(err)
        }
        f5Client.DisableCertCheck()

        ltmClient := ltm.New(f5Client)

        vsConfigList, err := ltmClient.Virtual().ListAll()
        if err != nil {
                fmt.Println(err)
        }
        fmt.Println(vsConfigList)

        config := bigip.ConfigOptions{
                APICallTimeout: 10000,
        }
        f5 := bigip.NewSession("https://<f5-ipaddress>", "username", "password", &config)

        vservers, err := f5.VirtualServers()
        if err != nil {
                fmt.Println("THERE WAS AN ERROR")
                fmt.Println(err)
        }

        fmt.Println(vservers)

        test, err := f5.GetVirtualServer("virtual-server-name")
        if err != nil {
                fmt.Println("THERE WAS AN ERROR")
                fmt.Println(err)
        }
        fmt.Println(test)

        for _, vs := range vservers.VirtualServers {
                fmt.Printf("Name: %s\n", vs.Name)
        }
}

Since I’m receiving the same error from both packages, I have a feeling I’m not understanding something.

Turns out the “APICallTimeout” is in nanoseconds so I was setting my timer way to small. I adjusted to APICallTimeout: 100 * time.Second and that corrected the issue.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.