This question is locked. New answers and comments are not allowed.
Hi,
I am trying to use the Everlive SDK within a Cloud Function and am having some trouble with what seems that the then() block is not entering. For example see this piece of code, where the first console.info works fine, but the console.log in the then() block does not show nor is the response body returned.
Probably I am missing something that is related to using the SDK within a Cloud Function.
Any advice?
Thanks!
Everlive.CloudFunction.onRequest(
function
(request, response, done) {
console.info(JSON.stringify(request.data));
// works fine
var
availability = Everlive.Sdk.$.data(
'Availability'
);
var
existingContactsFilter =
new
Everlive.Sdk.Query();
existingContactsFilter.select(
'username'
).where().isin(
'username'
, [
'user1'
,
'user2'
]);
availability.get(existingContactsFilter).then(
function
(data){
console.log(JSON.stringify(data));
// doesn't show up
response.body = JSON.stringify(request.data);
// nor is this response returned
},
function
(error){
console.log(JSON.stringify(error));
});
done();
});