question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remix SDK invariant is not captured as Issue

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/remix

SDK Version

7.5.0

Framework Version

7.5.0

Link to Sentry event

https://sentry.io/organizations/netzerorg/performance/trace/7a8e8c962aa242aabb565917ff0c891c/

Steps to Reproduce

import invariant from "tiny-invariant";

export const loader: LoaderFunction = async ({ params }) => {
  const user = params["*"];
  invariant(user, "user is required");
  const user= await getUser({ user: user});
  return json({
    user,
  });
};

Now, navigate to a route where the user does not exist.

Expected Result

Invariant is triggered and thrown and an issue is created in sentry dashboard

Actual Result

Invariant is triggered and thrown, however sentry only receives a transaction and doesn’t flag it as an issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:29 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
moishinetzercommented, Jul 10, 2022

Super quick update, after further research it seems that https://github.com/getsentry/sentry-javascript/issues/5401#issuecomment-1179791517 is definitely what the ReferenceError: name is not defined error is about.

After patching locally not only did the name error go away, the invariant triggers in sentry correctly!

image

My changes:

    try {
      const span = activeTransaction.startChild({
        op: 'remix.server.documentRequest',
        description: activeTransaction.name,
        tags: {
          method: request.method,
          url: request.url,
        },
      });

      res = await origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context);

      span.finish();
    } catch (err) {
--      captureRemixServerException(err, name);
++      captureRemixServerException(err, 'loader');
      throw err;
    }

I’m going to try test this out on the deployed version and update this comment accordingly. Fingers crossed!

Update:

After applying the above change to the deployed version the ReferenceError: name is not defined error does not show and the invariant gets sent correctly as an issue so it’s the same result as local!

However the issue mentioned earlier Object.captureException still remains.

1reaction
moishinetzercommented, Jul 28, 2022

@AbhiPrasad yes, received! Just saw it now thanks for the bump!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Loading - Remix
While loading data it's common for a record to be "not found". As soon as you know you can't render the component as...
Read more >
Invariant Violation: Element type is invalid: expected a string ...
This error can rise if you try to import a non-existent component. Make sure you have no typo and that the component indeed...
Read more >
Remix IDE: How to debug a contract having a function with a ...
As in your initial question, there is no constructor, there is nothing to step through. The problem is that you are not calling...
Read more >
Integrate Remix with Cloudflare Pages - Jacob Paris
Miniflare does not open the browser by default. You have to opt-in by passing the --open flag, so you can just avoid doing...
Read more >
Tracking Large-Scale Video Remix in Real-World ... - IEEE Xplore
“quoting” video and tracking video reuse do not exist. ... to capture the topic theme, as well as the generally understood cause, phenomena, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found