Skip to content

Conversation

@Scra3
Copy link
Member

@Scra3 Scra3 commented Dec 19, 2025

Summary

  • Make @fastify/express import lazy instead of top-level
  • Fixes error when users use Express/Koa/other frameworks without having fastify installed

Problem

When fastify is not installed (because the client uses Express, Koa, or another framework), the agent throws an error:

Error: Cannot find module 'fastify/lib/symbols'
Require stack:
- node_modules/@fastify/express/index.js
- node_modules/@forestadmin/agent/dist/fastify-adapter.js

Solution

Use dynamic import() for @fastify/express only when it's actually needed (when mountOnFastify is called).

Test plan

  • All existing framework-mounter tests pass (24 tests)
  • Build passes

🤖 Generated with Claude Code

When users use Express, Koa, or other frameworks without Fastify,
they were getting an error about missing 'fastify/lib/symbols' because
@fastify/express was imported at the top level.

This change makes the import lazy - @fastify/express is only imported
when actually needed (when mounting on Fastify).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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