Rust
9 posts on Rust.

Axum "Handler<_, _> Is Not Satisfied": Eight Causes, Eight Repros
The trait bound fn(...): Handler<_, _> is not satisfied looks the same whatever you broke. I reproduced eight causes on axum 0.8.9, ran each one with and without #[axum::debug_handler], and wrote down the line that names the cause and the fix.
11 min read

GLIBC_2.38 Not Found: a Rust Binary in debian-slim and Distroless
My Axum binary built on rust:1 ran fine on bookworm-slim. Then I added vendored OpenSSL and it died before main with version GLIBC_2.38 not found. How to read the error, the objdump line that explains it, and three fixes I built and measured.
11 min read

sqlx Offline Mode: Building in Docker and CI With No Database in Sight
sqlx's query! macros check every query against a live Postgres at compile time, so a plain docker build fails. How I build with SQLX_OFFLINE and a committed .sqlx folder, the .env that quietly turned it off, and the schema change that compiled fine and panicked at runtime.
12 min read

SIGTERM, Not SIGKILL: Graceful Shutdown in Axum
Ctrl+C and docker compose stop both killed my axum server on the spot. How with_graceful_shutdown and tokio::select! let it finish what it started, the copied line that quietly disabled it, and a request that outlived the signal.
5 min read

JSON Logs in Rust, With the Level in a Config File Instead of RUST_LOG
Structured JSON logs with tracing in a Rust backend: a log level read from the same TOML file as everything else, fields instead of sentences, the error that only shows up in tests, and the rule for which errors deserve a log line.
6 min read

Liveness vs Readiness in Axum, and the Health Check That Always Said OK
My readiness endpoint answered 200 with the database gone, because a handler with no return type answers 200. Two health checks in axum that mean different things, an empty 503, and tests that call the router without opening a port.
5 min read

Why My Rust Backend Is Not Allowed to Log In as postgres
A superuser skips row-level security, so a backend that logs in as postgres turns every RLS policy into decoration. How I split the database into three roles, why the password is a file and not an env var, and what the sqlx pool does with it.
6 min read

My Rust Backend Exited With Code 0 While the Database Was Down
The database was down, the backend printed nothing and exited 0. Three small mistakes with map_err, unwrap and a missing .await made a failing service look healthy. How errors should travel up to main, and the one test that catches it.
6 min read

My Rust Backend Refuses to Start With a Bad Config File, On Purpose
One TOML file, read once at startup, and the backend doesn't start if a single key is wrong. Why I picked TOML, how serde does most of the validation, why the log level is an enum, and the error message that printed my whole config file.
7 min read