Overview
Product search incidents typically involve:- Missing dependencies for search functionality
- Pagination calculation errors
- Query parameter handling issues
Incidents
INC-108: Missing fuse.js Dependency
INC-108: Missing fuse.js Dependency
Summary
Severity: P2 - HighService: node-service
Date: 2026-02-28
Environment: StagingThe product search endpoint returned 500 errors due to a missing
fuse.js dependency. The module was used in code but not added to package.json.Problem
CallingGET /api/products/search?q=widget resulted in:Error message:Root Cause
The search functionality was implemented using thefuse.js library for fuzzy search, but the dependency was never added to package.json. The developer likely installed it locally during development but forgot to save it to dependencies.Problematic code (src/routes/products.js:34-58):Resolution
- Install and save the dependency:
- Verify
package.jsonincludes the dependency:
- Commit the updated
package.jsonandpackage-lock.json
Prevention
- Always use
npm install --save(ornpm installwhich saves by default in modern npm) when adding dependencies - Run
npm ciin CI/CD pipelines to catch missing dependencies before deployment - Add a pre-commit hook to verify all
require()statements have corresponding dependencies:
- Use tools like
depcheckto find missing or unused dependencies:
INC-106: Pagination Off-by-One Error
INC-106: Pagination Off-by-One Error
Summary
Severity: P2 - HighService: node-service
Date: 2026-02-28
Environment: ProductionProduct listing pagination returned wrong results. Page 1 showed items 11-20 instead of 1-10, skipping the first page of products entirely.
Problem
The offset calculation was incorrect, causing page numbers to be off by one:GET /api/products?page=1&limit=10returned products 11-20 (expected 1-10)GET /api/products?page=2&limit=10returned products 21-30 (expected 11-20)
Root Cause
Thepaginate() utility function calculated offset incorrectly using page * limit instead of (page - 1) * limit.Problematic code (src/utils/formatters.js:34-45):- Page 1:
offset = 1 * 10 = 10(skips first 10 items) - Page 2:
offset = 2 * 10 = 20(skips first 20 items)
Resolution
Fix the offset calculation to use zero-based indexing:Fixed code:- Page 1:
offset = (1 - 1) * 10 = 0(starts at first item) - Page 2:
offset = (2 - 1) * 10 = 10(starts at 11th item) - Page 3:
offset = (3 - 1) * 10 = 20(starts at 21st item)
Prevention
- Write unit tests for pagination logic:
- Add integration tests that verify actual data returned:
- Use established pagination libraries or patterns:
Best Practices
Dependency Management
Always save dependencies:- Commit
package-lock.jsonto version control - Use
npm ciin production/CI instead ofnpm install