Blog

Posts tagged “Fastify”

Fastify logging guide header: 'Get more from Fastify's built-in pino logger' beside an illustrative JSON log line with reqId, route /orders/:id, authorization [redacted], statusCode 200
Logging

Fastify logging: getting the most from the built-in pino logger

Fastify logs every request out of the box, but the default skips routes, user agents and bodies, and Fastify 4 trusts client request ids. A tested production config for Fastify 4 and 5.

Jason Fill November 13, 2026 11 min read
Fastify monitoring header: terminal showing an onResponse timing log, @fastify/otel spans for loadUser, handler and request, and an under-pressure 503 from a test run on Fastify 5.12.8
Monitoring

Fastify monitoring: hooks, metrics and APM for Fastify 4 and 5

Set up Fastify monitoring that shows which route got slow and why: onResponse timings, fastify-metrics histograms, @fastify/otel spans per hook, and under-pressure load shedding, with output from real runs.

Jason Fill November 13, 2026 10 min read
Bar chart: ALB idle timeout 60 s, old Node keepAliveTimeout 5 s causing a 502 when the ALB reuses a closed socket, and a fixed keepAliveTimeout of 65 s, with the code server.keepAliveTimeout = 65_000; server.headersTimeout = 66_000;
Monitoring

Node.js server timeouts: requestTimeout, headersTimeout and keepAliveTimeout

Random 502s behind a load balancer often come down to one setting: keepAliveTimeout. What each Node.js server timeout controls, safe values behind an AWS ALB, and how to confirm the fix.

Jason Fill November 11, 2026 5 min read
401 vs 403 in your API logs: illustrative log lines showing a burst of 401s on POST /login from one IP ending in a 200, then 403s on sequential invoice IDs
Debugging

401 vs 403 in your Node API logs: what each pattern means

401 and 403 look alike in a log but answer different questions. What each means under RFC 9110, four auth patterns worth an alert, how to return the right one in Express and Fastify, and five searches to run on last week's logs.

Jason Fill November 8, 2026 4 min read
Header image: Scanners want your .env and your .mcp.json
Security

Block .env and config-file probes in Express and Fastify

One site logged 1,028 requests for credential paths in a day, including /.mcp.json and other AI tool configs. How to check none can succeed, return a fast 404 in Express and Fastify, and block the IPs doing it.

Jason Fill November 6, 2026 4 min read
Node.js large file upload, no OOM. Cover graphic for a guide to streaming large uploads in Node.js without running out of memory.
Coding

Node.js large file upload handling without running out of memory

One 2 GB upload should not take your API down with it. Here is how to stream uploads in Express and Fastify, when to use presigned URLs, and which parsers to patch.

Jason Fill October 5, 2026 6 min read
Cursor vs offset pagination at page 4000. Cover graphic for a guide to keyset pagination in Node.js and Postgres APIs.
Coding

Cursor vs offset pagination: an API design that survives big tables and scrapers

Offset pagination was fast at launch; now deep pages hammer the database and one API key is walking every page. Here is when to switch to cursors and how.

Jason Fill August 21, 2026 6 min read
Header: 'Your MCP server is an API. Debug it like one.' beside an illustrative log of MCP calls returning 200, 404 (session not found), 401 (token expired) and 499 (client gave up).
Debugging

Your MCP server is an API. Debug it like one.

A remote MCP server works on localhost, then fails in production with a vague "tool call failed." Lost sessions behind a load balancer, expiring OAuth tokens and proxies that cut streams off are all visible at the HTTP layer. Here's where to look.

Jason Fill August 12, 2026 8 min read
Zod validation, before the 500. Cover graphic for a guide to validating request bodies and query strings with Zod in Express and Fastify.
Coding

Zod validation in Express and Fastify: request bodies, query strings and useful errors

A null where your handler expected an array becomes a 500 and a support ticket. Validate bodies, query strings and params with Zod 4 in Express 5 and Fastify 5, return 400s clients can act on, and stop extra fields at the door.

Jason Fill July 17, 2026 6 min read
Spot a CORS misconfiguration in one curl. Cover graphic for a guide to finding, fixing and testing CORS misconfiguration in Express and Fastify.
Security

CORS misconfiguration in Express and Fastify: how to find it and test for it

One line added to silence a frontend error, cors({ origin: true, credentials: true }), lets any website read your users' data. Find CORS misconfiguration in Express and Fastify APIs, fix it, and test it in CI.

Jason Fill June 12, 2026 5 min read
Fastify hooks: which one does what. Cover graphic for a guide to using Fastify onRequest, preHandler and onResponse hooks for auth and logging.
Coding

Fastify hooks for logging and auth: onRequest, preHandler and onResponse explained

Auth checks that run before the body exists, log lines missing the status code, handlers that run after a 401: most come from using the wrong Fastify hook. Here is which hook does which job in Fastify v5, with working code.

Jason Fill April 20, 2026 6 min read
BOLA vulnerability: one digit away. Cover graphic for a guide to fixing BOLA and IDOR in Node APIs and spotting probing in request logs.
Security

BOLA vulnerability in Node APIs: how to fix IDOR and catch it in your logs

Change one digit in a URL and get another customer's invoice. Here is how to fix BOLA and IDOR structurally and spot someone probing for it before they find a gap.

Jason Fill April 13, 2026 6 min read