
Building a RAG API in Node.js: the setup I’d ship in 2026
Build a production RAG API in Node.js with OpenAI embeddings, pgvector, chunking, metadata filters, streaming answers, citations, and cost controls.

Build a production RAG API in Node.js with OpenAI embeddings, pgvector, chunking, metadata filters, streaming answers, citations, and cost controls.
| Error | What it means / fix |
|---|---|
| UnhandledPromise | Express.js async error handling that actually works in 2026 Express.js async error handling that actually works in 2026: Express 5 native catching, the express-async-errors patch for legacy apps, typed error classes, and the Sentry integration that survives a bad deploy. |
| MODULE_NOT_FOUND | Fix “Cannot find module” in Node.js (CommonJS, ES modules, TypeScript) Fix Cannot find module in Node.js: CommonJS vs ESM resolution rules, TypeScript path aliases at runtime, file case-sensitivity, monorepo workspace pitfalls, and the diagnostic tree I hand new engineers. |
| EADDRINUSE | Fix EADDRINUSE: address already in use in Node.js (Mac, Linux, Windows) Fix EADDRINUSE: address already in use in Node.js on Mac, Linux, and Windows. The kill commands per OS, the TIME_WAIT trap, graceful shutdown, and how to stop it from coming back. |





I've shipped APIs on all three. Sequelize from 2017 to 2020 on a payments API that's still in production. TypeORM through 2021 on a logistics dashboard, where the migration generator broke twice and burned a sprint each time.…