Closed atefhaloui closed 1 year ago
Hi @atefhaloui,
Thank You for opening the issue. At first glance it seem that You are right and those 3 lines of code are missing. We will investigate it further and fix it.
With regards, Dawid
Hi,
As a side note, I used to get 401 errors when activating a list while all my calls are correct: this drive me crazy for some time. After further investigation, I realized that I'm not correctly initializing the edgedrid.MaxBody
field ; as I'm initalializing the edgegrid.Config
structure externally using my yaml global config file, I've missed to set it to edgegrid.MaxBodySize
if the field is not set (equal to 0).
I think that this should be more explained in the documentatin.
Cheers
Hi,
Thank You for the feedback. Could You please provide sample configuration You have used (without any sensitive information)? When MaxBody is not provided, it should default to MaxBodySize automatically. Please also provide information about the environment: operating system, edgegrid-golang version.
With regards, Dawid
Hi Dawid, As I said, this is a simple documentation issue ;) In my case, my environment is:
Edgegrid: v6.0.0
I'm using a global configuration yaml file where I store edgegrid credential so I'm not using ~/.edgerc
:
// AkamaiConfig required configuration parameters to initialize the akamai server part.
EdgeGridConfig struct {
Host string `yaml:"host" validate:"required"`
ClientToken string `yaml:"client_token" validate:"required"`
ClientSecret string `yaml:"client_secret" validate:"required"`
AccessToken string `yaml:"access_token" validate:"required"`
AccountKey string `yaml:"account_key,omitempty"`
HeaderToSign []string `yaml:"headers_to_sign,omitempty"`
MaxBody int `yaml:"max_body,omitempty"`
RequestLimit int `yaml:"request_limit,omitempty"`
Debug bool `yaml:"debug,omitempty"`
}
and I'm using a simple copy constructor method
func EdgeGridCredentials(cfg *EdgeGridConfig) *edgegrid.Config {
conf := edgegrid.Config{
Host: cfg.Host,
ClientToken: cfg.ClientToken,
ClientSecret: cfg.ClientSecret,
AccessToken: cfg.AccessToken,
AccountKey: cfg.AccountKey,
HeaderToSign: cfg.HeaderToSign,
MaxBody: cfg.MaxBody,
RequestLimit: cfg.RequestLimit,
Debug: cfg.Debug,
}
// --> without this check will keep getting 401 status with 'signature mismatch' message
if conf.MaxBody <= 0 {
conf.MaxBody = edgegrid.MaxBodySize
}
return &conf
}
Sincerely, Atef
This issue is now fixed with recent release
Hi, I'm playing with the networklists API and it seems that when a 4xx happens when activating a network list the error is not handled. Instead, in the function
CreateActivations()
just after the call top.Exec(req, &rval, params)
we're not making a check toresp.StatusCode
but we're trying to get the new activation status directly --> this call will succeed and the entire call toCreateActivations()
will succeed.I think that we must add the following check on line 353 (based on v6.0.0):
Cheers