Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS 13 Bug: Tracing Instrumentation breaks next/link elements with prefetching #260

Open
angel1254mc opened this issue Aug 30, 2023 · 3 comments
Labels
bug Report a bug

Comments

@angel1254mc
Copy link

angel1254mc commented Aug 30, 2023

Description

Enabling the Tracing Instrumentation in a Next13 project (App Router) with Faro breaks link that use prefetching (which is set to true for all links by default).

Steps to reproduce

I've included an example on CodeSandbox that you can fork to test it out on your own Faro Project :)

  1. Fork this codesandbox project.

  2. Create a Faro Project

  3. Enter your project URL and project name into the corresponding environment variables in .env.local

  4. Note that the <Link/> component on line 37 has it's prefetch set to true

  5. Click on the Link

  6. Note that the link has been clicked ('link clicked!' message in console) but no routing has occured (still on the same page)

  7. Now set prefetch on the link on line 37 to false

  8. Refresh the window

  9. Click on the Link and notice that you are routed to the correct URL (now on test-route page)

Expected behavior

We expect that you are able to successfully route in both cases, with or without prefetching.

Actual behavior

Routing with next/link only works with TracingInstrumentation if prefetching is explicitly disabled for all <Link/> components

Environment

  • SDK version: 1.1.2
  • SDK instrumentations: WebInstrumentations, TracingInstrumentation
  • Device type: Desktop
  • Device name: ASUS ROG Zephyrus G14
  • OS: Windows 11
  • Browser: Google Chrome 116

Demo

CodeSandbox Link
https://codesandbox.io/p/sandbox/crazy-matan-g5f27w?file=%2Fnext.config.js%3A1%2C1
Demo Video

Next13-Faro-Routing-issue-demo.mp4

Context

Wasn't sure whether to report this on Faro repo, otel-js repo, or NextJS repo but if this is something that you all think belongs on there instead, I'll close this issue :)

@angel1254mc angel1254mc added the bug Report a bug label Aug 30, 2023
@rawnly
Copy link

rawnly commented Sep 4, 2023

same happening here, it would be nice to have a suggested configuration for nextjs projects too

@riboher
Copy link

riboher commented Feb 7, 2024

I was thinking of adding a new issue since I'm not having the problem in a NextJS application, but this is too happening to me in a common React app with ReactRouter.

The thing is we're using the loaders functionality together with Await and Suspense components, which I think is causing the same problems as the prefetch prop in NextJS

@clementduveau
Copy link

For future reference: related to #219 and apparently could also impact Svelte (not verified, rumored)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report a bug
Projects
None yet
Development

No branches or pull requests

4 participants