I have a simple go google cloud fn that does some calculation and then reports certain data, say X, to my slack API which is supposed to send a message with X to a slack channel.
I tested X on postman, and slack did send a message successfully. However, in my cloud function, right at where http.Post
is invoked, the function stops responding, and logs read 'function finished with status: cannot communicate with the function'.
func sendMessage(domains []BadDomain) (*http.Response, error) {
requestBody, err := prepareBody(domains)
if err != nil {
log.Fatal("Error preparing the request body --- ", err)
return nil, err
} else {
resp, err := http.Post(url, "application/json", requestBody)
if err != nil {
return nil, err
} else {
return resp, nil
}
}
}
requestBody
is io.Reader
. The json payload is correct, I have tested it via postman.