Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 31, 2025

Fixes FER-

Short description of the changes made

Adds URL handling to FernSvgIconServer to convert /_local/ paths to absolute URLs for server-side fetch operations. The Node.js fetch() API requires absolute URLs, but in local dev mode (fern docs dev), SVG icon paths like /_local/Users/.../icon.svg are relative.

The fix:

  • Converts /_local/ paths to absolute URLs using NEXT_PUBLIC_FDR_ORIGIN
  • Leaves absolute URLs (http/https) unchanged
  • Other relative paths pass through unchanged (will fall back to Image component if fetch fails)

What was the motivation & context behind this PR?

Custom icons in fern docs dev were failing with:

[FernSvgIconServer] Failed to fetch SVG: /_local/Users/.../icon.svg TypeError: Failed to parse URL from /_local/...

This caused tabs with custom icons to hang indefinitely. The middleware handles /_local/ paths for browser requests by redirecting to FDR origin, but FernSvgIconServer runs server-side during SSR (React Server Component), bypassing the middleware entirely.

Link to Devin run: https://app.devin.ai/sessions/fd7d1417418a4558b5acb0e326031194
Requested by: Catherine Deskur (catherine@buildwithfern.com)

How has this PR been tested?

Not tested locally yet - needs verification with fern docs dev to confirm custom icons load correctly for customers using local file paths.

Human review checklist

  • Verify NEXT_PUBLIC_FDR_ORIGIN is always set when /_local/ paths are used in local dev
  • Note: If NEXT_PUBLIC_FDR_ORIGIN is not set, the relative URL passes through unchanged, fetch will fail, and it falls back to the Image component - is this acceptable?

The server-side fetch() requires absolute URLs. This fix:
- Converts /_local/ paths to absolute URLs using NEXT_PUBLIC_FDR_ORIGIN
- Falls back to constructing URLs from request headers for other relative paths
- Fixes custom icon loading in fern docs dev mode

Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link
Contributor

vercel bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dev.ferndocs.com Ready Ready Preview Dec 31, 2025 8:33pm
fern-dashboard Ready Ready Preview Dec 31, 2025 8:33pm
fern-dashboard-dev Ready Ready Preview Dec 31, 2025 8:33pm
prod-assets.ferndocs.com Ready Ready Preview Dec 31, 2025 8:33pm
prod.ferndocs.com Ready Ready Preview Dec 31, 2025 8:33pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
fern-platform Ignored Ignored Dec 31, 2025 8:33pm

Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

🌱 Smoke Test Preview

Run at: 2025-12-31 20:31:51 UTC

Testing branch changes with smoke test content:

🕷️ Smoke Test Crawler Results

Pages crawled: 49
Successful: 49 ✅
With errors: 0

🎉 All pages loaded successfully with no errors!

@chdeskur chdeskur merged commit c0fc99b into app Dec 31, 2025
21 of 23 checks passed
@chdeskur chdeskur deleted the devin/1767212438-svg-local-url-fix branch December 31, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants