Interactive Challenges

Live Code Challenges

Test your cloud and serverless knowledge with hands-on puzzles. Pick the right answer and learn why it works.

0/6 completed
0/120 pts

Fix the Lambda Handler

Easy
+10 pts

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.

challenge.js
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