fix (docs): Laminar observability - add note on next.config#6248
Merged
nicoalbanese merged 2 commits intovercel:mainfrom May 13, 2025
lmnr-ai:docs/laminar
Merged
fix (docs): Laminar observability - add note on next.config#6248nicoalbanese merged 2 commits intovercel:mainfrom lmnr-ai:docs/laminar
nicoalbanese merged 2 commits intovercel:mainfrom
lmnr-ai:docs/laminar
Conversation
nicoalbanese
approved these changes
May 13, 2025
lgrammel
pushed a commit
that referenced
this pull request
May 16, 2025
## Background Like many other OpenTelemetry instrumentations, Laminar depends on `@opentelemetry/instrumentation`, which, in turn, depends on `require-in-the-middle` and `import-in-the-middle`. Importing and initializing Laminar inside Next.js `instrumentation.ts` file causes Next.js to try resolving these two packages, but fails, and results in: - Laminar not being able to send traces. This is because unlike many other instrumentation libraries, Laminar is not intrusive and does not set its tracer provider globally (so that others, e.g. `@vercel/otel` can set theirs). - Error messages (see below) We have tried many different things to debug, including bundling Laminar differently, shipping those two packages within Laminar as `noExternal`, adding a separate entrypoint in our package for Next.js, but nothing seems to have worked. The only thing that's worked was adding `@lmnr-ai/lmnr` in `serverExternalPackages` in [next.config](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages). ## Summary Add a subsection within the Next.js section that describes
lgrammel
added a commit
that referenced
this pull request
May 16, 2025
…6350) ## Background Like many other OpenTelemetry instrumentations, Laminar depends on `@opentelemetry/instrumentation`, which, in turn, depends on `require-in-the-middle` and `import-in-the-middle`. Importing and initializing Laminar inside Next.js `instrumentation.ts` file causes Next.js to try resolving these two packages, but fails, and results in: - Laminar not being able to send traces. This is because unlike many other instrumentation libraries, Laminar is not intrusive and does not set its tracer provider globally (so that others, e.g. `@vercel/otel` can set theirs). - Error messages (see below) We have tried many different things to debug, including bundling Laminar differently, shipping those two packages within Laminar as `noExternal`, adding a separate entrypoint in our package for Next.js, but nothing seems to have worked. The only thing that's worked was adding `@lmnr-ai/lmnr` in `serverExternalPackages` in [next.config](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages). ## Summary Add a subsection within the Next.js section that describes Co-authored-by: Dinmukhamed Mailibay <47117969+dinmukhamedm@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Like many other OpenTelemetry instrumentations, Laminar depends on
@opentelemetry/instrumentation, which, in turn, depends onrequire-in-the-middleandimport-in-the-middle. Importing and initializing Laminar inside Next.jsinstrumentation.tsfile causes Next.js to try resolving these two packages, but fails, and results in:@vercel/otelcan set theirs).We have tried many different things to debug, including bundling Laminar differently, shipping those two packages within Laminar as
noExternal, adding a separate entrypoint in our package for Next.js, but nothing seems to have worked.The only thing that's worked was adding
@lmnr-ai/lmnrinserverExternalPackagesin next.config.Example error message without turbopack:
Example error message with Turbopack
Summary
Add a subsection within the Next.js section that describes
Verification
Syntax highlighter for MDX
Tasks
pnpm changesetin the project root)pnpm prettier-fixin the project root)Future Work
Related Issues