Hi,
I’m trying to pass some parameters between a front end to the serverless app, then pass a response back to the front end. (the concept is part of a bigger plan for: Select (fw-select) | Crayons (freshworks.com) with select custom data source.
Using the below I am getting the information from the front end to the serverless and can print the response to confirm this, but nothing is being returned to the front end:
frontend.js
.invoke('onGetTenants', payload)
.then(function (response) {
console.log('Serverless function executed successfully:', response);
})
.catch(function (error) {
console.log('Error while executing serverless function:', error);
});
server.js
exports = {
onGetTenants: async function (args) {
return new Promise((resolve, reject) => {
const data = args;
console.log(data);
if (data.name && data.age) {
const response = `Hello ${data.name}, you are ${data.age} years old`;
resolve(response);
} else {
const error = 'Invalid data';
reject(error);
}
});
}
}
I can see the response coming into the server aspect the the data being printed on the console. But from the browser console.logs i’m getting the follow error:
Error while executing serverless function:
{status: 504, message: ‘Timeout error while processing the request.’, errorSource: ‘APP’}