i have a lambda fn written in nodejs which simply uses the following code snippet. the lambda fn tests fine.however, when i call the api-gateway , i get a 502 bad server
"Execution failed due to configuration error: Malformed Lambda proxy response"
what i want is for the api gateway to give me the output in a json format. As a javascript noob, any help is appreciated!
'use strict';
const AWS = require("aws-sdk");
const S3 = require("aws-sdk/clients/s3");
const s3 = new AWS.S3();
module.exports.listbuckets = async (event) => {
const mybuckets = await s3.listBuckets().promise();
console.log(mybuckets);
return JSON.stringify(mybuckets);
};