Spot the bug in shared request state

from Backend development
Node 24 intermediate 4 min 1 issue to find

Find the concurrency bug in this generated request handler.

JavaScript
let currentPrincipal;

async function handle(request) {
  currentPrincipal = await authenticate(request);
  await loadDashboard();
  return { userId: currentPrincipal.id };
}
Open in playground
Report an error