Node.js Communication & Stakeholder Relations 4 — Questions and Answers
Question 1: A business analyst wants to understand your Node.js service's throughput. Which metric most clearly communicates capacity to non-engineers?
- V8 heap size in megabytes
- Requests per second (RPS) under normal and peak load (Correct answer)
- Number of active libuv handles
- GC pause duration in milliseconds
Correct answer: Requests per second (RPS) under normal and peak load
Requests per second is a universally understood throughput metric that directly maps to business capacity requirements.
Question 2: Your Node.js app uses child_process.fork() to offload CPU work. How do you communicate results back to the parent process?
- Write to a shared file and poll it
- Use process.send() in the child and listen for 'message' events on the ChildProcess object in the parent (Correct answer)
- Use global variables
- Return values from the forked function directly
Correct answer: Use process.send() in the child and listen for 'message' events on the ChildProcess object in the parent
Fork creates an IPC channel; child calls process.send(data) and the parent listens via childProcess.on('message', handler).
Question 3: A security stakeholder asks how your Node.js API prevents sensitive data from appearing in error logs. What is the best practice?
- Disable all error logging
- Sanitize error objects before logging by removing PII fields, passwords, and tokens (Correct answer)
- Log everything to a private S3 bucket
- Use try/catch only at the top level
Correct answer: Sanitize error objects before logging by removing PII fields, passwords, and tokens
Sanitizing error objects before logging ensures passwords, tokens, and PII are stripped while preserving diagnostic information.
Question 4: You want to emit a deprecation warning to developers using an older version of your Node.js module. Which mechanism is preferred?
- Throw an Error immediately
- Use process.emitWarning() with type 'DeprecationWarning' (Correct answer)
- Add a TODO comment in the code
- Return null silently
Correct answer: Use process.emitWarning() with type 'DeprecationWarning'
process.emitWarning() with type 'DeprecationWarning' integrates with Node.js's warning system and appears in logs without crashing the process.
Question 5: A stakeholder requests that your Node.js microservice notify an external webhook whenever an order ships. What pattern should you implement?
- Have the external service poll your database directly
- Use an HTTP POST from Node.js to the stakeholder's webhook URL upon order ship event (Correct answer)
- Send an email instead of HTTP
- Use a browser-based notification
Correct answer: Use an HTTP POST from Node.js to the stakeholder's webhook URL upon order ship event
Webhooks push event data via HTTP POST to an external URL, enabling real-time integration without the receiver needing to poll.
Question 6: You are explaining async/await error propagation to a junior developer. What happens if an async function throws inside a Promise.all() array?
- All other promises continue and the error is ignored
- Promise.all() immediately rejects with the first error, but other promises continue running (Correct answer)
- The process crashes
- The error is automatically retried
Correct answer: Promise.all() immediately rejects with the first error, but other promises continue running
Promise.all() short-circuits on the first rejection, but in-flight promises are not cancelled — they continue running but their results are ignored.
Question 7: A stakeholder wants to audit all API calls made by your Node.js service to third-party APIs. Which approach supports this requirement?
- Inspect network packets with tcpdump
- Implement an HTTP interceptor (e.g., via axios interceptors) that logs all outbound requests and responses (Correct answer)
- Ask the third-party provider for logs
- Enable Node.js --trace-warnings flag
Correct answer: Implement an HTTP interceptor (e.g., via axios interceptors) that logs all outbound requests and responses
Axios request/response interceptors centralize outbound request logging without modifying individual call sites.
A business analyst wants to understand your Node.js service's throughput.
Which metric most clearly communicates capacity to non-engineers?