Error decoding lambda response: json / deploying a function

I have an issue when I try and deploy my Netlify functions to live, I receive this error message (although not when run locally).

error decoding lambda response: json: cannot unmarshal bool into Go value of type string.

Is this linked to returning:
exports.retData = oBody => {
console.log(‘retData’, oBody)
return {
statusCode: 200,
headers: {
“Access-Control-Allow-Origin”: “*”,
“Access-Control-Allow-Methods”: “GET,POST,DELETE”,
“Access-Control-Allow-Headers”:
“Access-Control-Allow-Headers, Origin, Accept, Authorization, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers”
},
body: JSON.stringify(oBody)
};
};

At a guess, oBody is a bare true or false (whether on purpose as designed or due to a fault), but the thing that parses your return object (presumably something written in Go?) expects body to be a string (which is not unreasonable for an HTTP response).

1 Like

Yes, @alexrussell, that’s correct. @BrianSHenderson, that error from our system is typically seen when the body you are returning is not a valid stringified JSON string. Can you share what the value of oBody is? It’ll need to be a JSON object and not just a boolean as alex also suspects.