Why use --unhandled-rejections=strict in Node.js development?
To make unhandled promise rejections throw, so you catch them in development instead of in production. This exposes missed error handling early, since in production an unhandled rejection can crash your server silently.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How to Debug Async Code in Node.js Effectively
Log at boundaries (start and end of async operations), use node inspect for breakpoints, check for forgotten await, trace event loop order with labeled logs, check error handling for unhandled rejections, and use --unhandled-rejections=strict to catch missed handling early.
If you see a Promise object where you expect a value, you forgot await. The function returned a promise instead of the resolved value. Always await async calls when you need the result, or the next code runs prematurely.
Because logging at the start and end of async operations shows where time goes and whether callbacks fire in the expected order. This is more useful than logging every line, and it reveals timing bugs without cluttering the output.
Still have questions?
Browse all our FAQs or reach out to our support team
