Client undefined after deploy
An AI assistant wrote this Lambda (TypeScript) with a lazily-initialized client to avoid paying init cost on cold starts. Occasionally requests fail with 'client is undefined' right after a deploy. Find the bug and explain when it triggers.
Implement
handler_completion_times(arrival_times: list[int], init_ready_time: int, handler_ms: int) → list[int]Examples
in
[[0,5,100],40,10]out[50,50,110]in
[[7,3,9],5,0]out[7,5,9]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 19 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.