-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[React Router] Transaction unexpectedly ended early, cancelling spans from componentDidMount() #6470
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
Comments
As a result of the problem described above, see that the bottom http.client txn here says 90.40ms... but when you click the plus '+' to open it, it says 3,447 ms Here's an additonal transaction showing the same problem. VIDEO - If you want to see the expected behavior (how it worked with JS SDK v6.X.X) watch this VIDEO (2minutes) where I show v6 versus v7 outcomes. You'll see that with v6 you get all those additional spans which are now getting cancelled in v7. |
Here is some output from using example1
example2
|
@smeubank - can we please get this prioritized and looked at? This is a critical bug for us, as showing/tracing the |
I'll take a look at this today! |
I can't get What environment variables should I be setting? There are a lot in here but not sure which ones I need: I don't think the build error is related to environment variables:
I'm in the Sentry Discord for direct messages! |
@timfish Hey Tim, to run our app: From top level directory
Or if you want to run it with hot reload:
|
Both of those give me an error because
I've tried creating |
Please create env-config/local.env with following content: SENTRY_ORG={FILL IN YOUR ORG SLUG} REACT_APP_DSN={{FILL IN YOUR DSN}} |
It turns out there are some older dependencies somewhere that cause this issue which meant it wasn't working with my default node (v18). It's now working with node v16 but this should probably be documented somewhere! For the JavaScript SDKs we use Volta which enforces the correct node version. It's nice because once setup and a version is pinned you can switch between projects and the correct version will be used with each. |
When the the page is first loaded, in sentry-javascript/packages/react/src/reactrouterv6.tsx Lines 189 to 201 in 2fa11eb
The problem is that it calls This logic doesn't seem correct to me but it's been there since v7.0 sentry-javascript/packages/react/src/reactrouterv6.tsx Lines 130 to 143 in 2fa11eb
@onurtemizkan have you got any idea? |
thank you for pointing this out Tim, we should use Volta or document it like you suggested. @onurtemizkan |
Yes, that seems implemented wrongly. When @realkosty, @ndmanvar: Could you confirm if the example below is what's expected on your side? |
@onurtemizkan Yes, that looks right! (assuming no distributed tracing "+" and double slashes in request URL is just something specific to your setup). |
wow, thanks so much for fixing this so quick Onur |
Verified fix in our app 👍 |
It seems the issue isn't fixed in my case. Running with debug:true.
Not sure what to provide to help you debug further. This is with 7.38.0 |
@erdillon Hi, the example you shared looks a bit like it's a very long-lived request that outlives the page navigation transaction (meaning a span cancellation would actually be the intended behavior). Because I think this is unrelated to this issue, would you mind opening a new issue with concrete reproduction steps so we can debug this further in case this is actually a bug? Thanks! |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/react
SDK Version
7.17.3 - but tested on 7.23.0 with same result
Framework Version
17.0.2 (react-router-dom: 6.4.3)
Link to Sentry event
https://sentry.io/organizations/testorg-az/performance/application-monitoring-javascript:755fa61c341044a19a38b718efff2b35/?project=5808623&query=sdk.version%3A7.17.3&referrer=performance-transaction-summary&statsPeriod=30d&transaction=%2Fproducts&unselectedSeries=p100()
Steps to Reproduce
0.1 Examine code that initiates span that gets cut short before it finishes: Products.js#L39 - called from
componentDidMount()
Expected Result
Transaction runs its course and does not finish prematurely before
http.client
span (GET https://.../products) is complete.Actual Result
http.client
span (GET https://.../products) of the transaction is cut short even though corresponding backend transaction is ~ 2 seconds.The text was updated successfully, but these errors were encountered: