Skip to content

Commit 1d87427

Browse files
github-actions[bot]Marfuenclaude
authored
fix(browserbase): install DejaVu Sans so overlay text renders in production (#2659)
The node:*-slim base images ship with zero fonts installed, so librsvg falls back to .notdef glyphs and the overlay rendered as □ □ □ boxes in production. Install fontconfig + fonts-dejavu-core in both Dockerfiles and use "DejaVu Sans" explicitly in the SVG. Co-authored-by: Mariano <marfuen98@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 05f44eb commit 1d87427

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

apps/api/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Use Node.js runtime for production
22
FROM node:20-slim
33

4-
# Install required packages (wget for healthcheck, curl/bash for bun install, libc compat for prisma)
5-
RUN apt-get update && apt-get install -y --no-install-recommends wget curl openssl && rm -rf /var/lib/apt/lists/*
4+
# Install required packages:
5+
# - wget for healthcheck, curl/bash for bun install, openssl for prisma
6+
# - fontconfig + fonts-dejavu-core so sharp/librsvg can render text in the
7+
# browser-automation screenshot overlay (node:*-slim ships with zero fonts)
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
wget curl openssl fontconfig fonts-dejavu-core \
10+
&& rm -rf /var/lib/apt/lists/*
611

712
WORKDIR /app
813

apps/api/Dockerfile.multistage

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ RUN groupadd --system nestjs && useradd --system --gid nestjs --create-home nest
8484
WORKDIR /app
8585
RUN chown nestjs:nestjs /app
8686

87-
# Install runtime dependencies + AWS RDS CA certificate bundle
88-
RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates \
87+
# Install runtime dependencies + AWS RDS CA certificate bundle.
88+
# fontconfig + fonts-dejavu-core are needed so sharp/librsvg can render text
89+
# in the browser-automation screenshot overlay (node:*-slim has no fonts).
90+
RUN apt-get update && apt-get install -y --no-install-recommends \
91+
wget ca-certificates fontconfig fonts-dejavu-core \
8992
&& wget -q -O /usr/local/share/aws-rds-ca-bundle.pem https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem \
9093
&& apt-get clean && rm -rf /var/lib/apt/lists/*
9194

apps/api/src/browserbase/screenshot-overlay.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ function buildBannerSvg(args: BannerArgs): string {
115115
const { width, height, instruction, sourceUrl, timestamp } = args;
116116
const rowFontSize = 12;
117117
const labelFontSize = 9;
118-
const fontFamily =
119-
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
118+
// Explicit Linux-safe font stack. The production container only ships
119+
// DejaVu Sans (via fonts-dejavu-core); Apple/Segoe/Roboto aren't available
120+
// so librsvg would render .notdef glyphs ("□ □ □") on servers.
121+
const fontFamily = '"DejaVu Sans", sans-serif';
120122

121123
const w = Math.floor(width);
122124
const h = Math.floor(height);

0 commit comments

Comments
 (0)