Here is the code I am trying to deploy:
exports.generateToken = functions.https.onRequest((request, response) => {
gateway.clientToken.generate({ }, function (err, response) {
var clientToken = response.clientToken;
response.send(clientToken);
});
});
And this is the error message generated during deploy:
10:36 error Expected error to be handled handle-callback-err
10:36 warning Unexpected function expression prefer-arrow-callback
Any help on how to fix this?
Missing error handling was causing the issue. After adding the following lines, I was able to deploy successfully:
exports.generateToken = functions.https.onRequest((request, response) => {
gateway.clientToken.generate({ }, function (err, response) {
// error has to be handled
if(err) {
// handle error here
} else {
var clientToken = response.clientToken;
response.send(clientToken);
}
});
});
Additional info is here.