Hi I'm receiving "Return statement missing. return context.res.empty() if no response is expected." when calling a function from the console.
code: require('dotenv').config();
const lambda = new AWS.Lambda({ accessKeyId: process.env.AWS_ACCESS_KEY_ID, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, region: process.env.AWS_REGION });
module.exports = async function ({req, res, log, error}) { log('Starting function V2...'); log('req:'); console.log(req); log('res:'); console.log(res);
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
const { functionName } = body;
try {
// Invoke action
res.json({
success: true,
message: "Action invoked successfully",
result: JSON.parse(result.Payload)
});
} catch (error) {
// Maneja cualquier error
res.json({
success: false,
message: "Error invoking Action",
error: error.message
});
}
};
Errors: Return statement missing. return context.res.empty() if no response is expected.
Use return res.json() instead of just calling res.json()
Recommended threads
- total parameter not working correctly in...
Hello Appwrite team, I'm experiencing issues with the total parameter in the listRows() method (TablesDB) across multiple SDKs. **Issue 1**: Node.js SDK (node...
- Accessing secure files from storage via ...
Hi everyone, can someone tell me what is the preferred way of accesssing user only files from storage in react native? I saved the file with user only read per...
- Confusion around Tables / TablesDB vs Da...
Hello everyone, I ran into quite a bit of confusion when trying to migrate a Function from Databases.createDocument() to the new Tables / Rows API and wanted t...