fix(journal,planner): resolve pino-pretty to an absolute path in dev #279

Merged
ullrich merged 1 commit from fix-journal-pino-pretty-dev into main 2026-10-17 11:52:57 +00:00
Owner

Problem

pnpm dev serves 500s for every Journal (and Planner) request:

[vite] Internal server error: unable to determine transport target for "pino-pretty"

pino resolves a bare transport target with createRequire() from its caller's file (util.getCallSites). Vite's SSR module runner evaluates logger.server.ts without a script name, so the call sites pino sees are [caller.js, pino.js, ""]. pino drops its own two frames, leaving only "", and resolution fails. Reproduced on Node 22, 24 and 26 and on main; not related to #278.

Fix

In both loggers, resolve the target via createRequire(import.meta.url).resolve("pino-pretty"). pino uses absolute targets as-is. This only runs outside production, where pino-pretty (a devDependency) is installed.

Verification

  • Journal and Planner dev servers return 200 with no pino error
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • Journal and Planner production builds pass

🤖 Generated with Claude Code

## Problem `pnpm dev` serves 500s for every Journal (and Planner) request: ``` [vite] Internal server error: unable to determine transport target for "pino-pretty" ``` pino resolves a bare transport target with `createRequire()` from its caller's file (`util.getCallSites`). Vite's SSR module runner evaluates `logger.server.ts` without a script name, so the call sites pino sees are `[caller.js, pino.js, ""]`. pino drops its own two frames, leaving only `""`, and resolution fails. Reproduced on Node 22, 24 and 26 and on `main`; not related to #278. ## Fix In both loggers, resolve the target via `createRequire(import.meta.url).resolve("pino-pretty")`. pino uses absolute targets as-is. This only runs outside production, where `pino-pretty` (a devDependency) is installed. ## Verification - Journal and Planner dev servers return 200 with no pino error - `pnpm typecheck` passes - `pnpm lint` passes - `pnpm test` passes - Journal and Planner production builds pass 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(journal,planner): resolve pino-pretty to an absolute path in dev
All checks were successful
CD Staging / Build & Push journal Image (pull_request) Has been skipped
CD Staging / Build & Push planner Image (pull_request) Has been skipped
CD Staging / Deploy Staging (pull_request) Has been skipped
CD Staging / Deploy PR Preview (pull_request) Has been skipped
CI / Dockerfile Package Check (pull_request) Successful in 6s
CI / Security Scan (pull_request) Successful in 9s
CI / Visual Tests (pull_request) Successful in 42s
CI / Journal Image Smoke Test (pull_request) Successful in 1m29s
CI / Checks (pull_request) Successful in 2m27s
CI / E2E Tests (pull_request) Successful in 4m5s
Cancel superseded CI / Cancel in-flight CI (pull_request) Successful in 2s
CD Staging / Tear Down PR Preview (pull_request) Successful in 13s
7d561dfdd5
`pnpm dev` 500s on every request with:

  Internal server error: unable to determine transport target for "pino-pretty"

pino resolves a bare transport target via createRequire() from its
caller's file (util.getCallSites). Vite's SSR module runner evaluates
logger.server.ts without a script name, so after pino skips its own
frames the only caller left is "" and resolution fails. Reproduced on
Node 22, 24 and 26 and on main.

Resolve the target from import.meta.url ourselves; pino uses absolute
targets as-is. Only done outside production, where pino-pretty (a
devDependency) is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ullrich deleted branch fix-journal-pino-pretty-dev 2026-10-17 11:52:57 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
trails-cool/trails!279
No description provided.