Node.js Bug Hunt Easy +10 XP
Sync in Async Context
This blocks the event loop and degrades performance.
Node.jsFind the bug
1
app.get('/file', (req, res) => {2
const data = fs.readFileSync('big.txt');3
res.send(data);4
}); The bug is on line 2
Select the correct fix
Show answer and explanation
Answer: Both A and C are better solutions
readFileSync blocks the entire event loop. Use async readFile or stream the file to avoid blocking other requests.
Hint: Sync file I/O blocks all other requests.
What this challenge tests
Bug Hunt in Node.js: async, event-loop, fs.