Hello,
I use a Mac to develop our in-house accounting tool and on a Mac M1 it runs without fault, debugs, compiles etc.
But when I copy the code to our Debian 12 server, and try to run it, the same code throws a fatal panic “Invalid memory address or nil pointer” on an api response. Apart from the OS the setup is the same, the latest go version etc.
I check for Errors on the response, but I get the panic when it try to use the payload…
response, err := client.FinancesAPI.ListFinancialEventGroups(&filter)
if err != nil {
fmt.Println(“Error”, err)
fmt.Println(err.Error())
}
gl := response.ResponseBody.Payload.FinancialEventGroupList. # here it throws the panic.
Is there something relevant only for linux, I was not aware of ?
[{0x14000f02000 0x14000f02010 0x14000f02020 0x14000f02050 2023-12-01 11:28:34 +0000 UTC } {0x14000f02090 0x14000f020a0 0x14000f020b0 0x14000f020c0 2023-12-02 05:28:44 +0000 UTC 0x14000f020f0 0x14000f02100 0x14000f02110 2023-11-24 12:26:54 +0000 UTC 2023-12-01 11:28:34 +0000 UTC}]
On linux the same code produces:
&{200 }
fatal panic
I understand the “nil-panic”, but not why the response is nil in the first place given the fact the credentials and filters where accepted, hence the 200. Also, the internal logger doesn’t produce any warnings or errors.
The response is &{200, nil, nil}. Amazon’s API seems perfectly fine with returning a nil ResponseBody and a nil ErrorList at the same time. I peeked into the sources of ListFinancialEventGroups but cannot see where or how it would do that.
The only difference that I can see is in the filter: it is set based on the current date & time.
Is the Debian system in a different time zone?
Is the time zone set correctly there?
If everything fails, I would suggest taking this strange API behavior as a given and treating the nil body as a special way of the API saying “no results”.
When attempting to deploy the same code on a Linux-based server, specifically Ubuntu 20.04, I’m an unexpected runtime panic. The error message cryptically points to an “invalid memory address or nil pointer,” and it occurs when I’m handling responses from an external API. I’ve checked for errors in the response, but the panic is triggered when attempting to access the payload data.