Test your cloud and serverless knowledge with hands-on puzzles. Pick the right answer and learn why it works.
This AWS Lambda handler is supposed to return a JSON response with a greeting, but it has a bug. The function executes without errors yet API Gateway always returns a 502 Bad Gateway. Find the correct fix.
exports.handler = async (event) => {
const name = event.queryStringParameters?.name || "World";
const greeting = `Hello, ${name}!`;
console.log(greeting);
// BUG: nothing is returned to API Gateway
};
Choose your answer