Registry /
http-networking / express-http-problem-details
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HttpProblemResponse
✓ import { HttpProblemResponse } from 'express-http-problem-details'
✗ const { HttpProblemResponse } = require('express-http-problem-details')
ESM import; commonjs require works but is discouraged.
ExpressMappingStrategy
✓ import { ExpressMappingStrategy } from 'express-http-problem-details'
✗ import ExpressMappingStrategy from 'express-http-problem-details'
Named export, not default. Available since v0.1.0.
default
✓ const HttpProblemResponse = require('express-http-problem-details').HttpProblemResponse
✗ const HttpProblemResponse = require('express-http-problem-details')
No default export; must destructure in CJS.
Express app using HttpProblemResponse middleware to map NotFoundError to RFC 7807 Problem Document.
import express from 'express';
import { HttpProblemResponse } from 'express-http-problem-details';
import { ProblemDocument } from 'http-problem-details';
import { DefaultMappingStrategy, MapperRegistry, ErrorMapper } from 'http-problem-details-mapper';
class NotFoundError extends Error {
constructor({ type, id }) {
super();
this.message = `${type} with id ${id} could not be found.`;
}
}
class NotFoundErrorMapper extends ErrorMapper {
constructor() { super(NotFoundError); }
mapError(error) {
return new ProblemDocument({ status: 404, title: error.message, type: 'http://tempuri.org/NotFoundError' });
}
}
const strategy = new DefaultMappingStrategy(
new MapperRegistry().registerMapper(new NotFoundErrorMapper())
);
const server = express();
server.get('/', (req, res) => { throw new NotFoundError({ type: 'customer', id: '123' }); });
server.use((err, req, res, next) => { console.error(err.stack); next(err); });
server.use(HttpProblemResponse({ strategy }));
server.listen(3000);
Errors
Common errors & fixes
TypeError: Cannot destructure property 'strategy' of 'undefined' or 'null'
HttpProblemResponse called without arguments.
fixserver.use(HttpProblemResponse({ strategy })) TypeError: strategy.mapError is not a function
The 'strategy' object does not implement the MappingStrategy interface.
fixUse an instance of DefaultMappingStrategy from http-problem-details-mapper.
TypeError: (intermediate value) is not iterable
MapperRegistry.registerMapper() expects a single mapper, not an array.
fixCall registerMapper multiple times, or pass mappers individually.
Audit
Dependencies
expressrequiredpeer dependency for middleware integration