How to Eliminate Request Context Prop Drilling in Node.js APIs with AsyncLocalStorage (2026 Guide)

javascript dev.to

You've probably written this before: async function getUser(userId: string, requestId: string, logger: Logger) { logger.info('Fetching user', { requestId, userId }); const user = await db.query('SELECT * FROM users WHERE id = $1', [userId]); return processUser(user, requestId, logger); // pass it down... again } async function processUser(user: User, requestId: string, logger: Logger) { logger.info('Processing user', { requestId }); // still passing it return enrichUser(user, reque

Read Full Tutorial open_in_new
arrow_back Back to Tutorials