Parse Cloud Code authentication issue

288 views Asked by At

I have a Cloud Code function that makes a request to an external API.

I am passing an api key in the header as required by the third party API. When I perform the same request using curl the response is as expected and the relevant data is returned.

When I call it in Cloud Code I get the following error:

Request failed; 60-111 Peer certificate cannot be authenticated with given CA certificates; Connection refused

My Cloud Code looks like this:

Parse.Cloud.httpRequest({
    url: "https://api.endpoint.url",
    headers: {
        "ApiKey": "api-key-example"
    }
}).then(function(httpResponse){
    console.log(httpResponse);
    response.success(httpResponse.text);
}, function(err){
    console.log(err);
    response.error(err);
});
0

There are 0 answers