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

"Non-Error promise rejection captured with value:" #3440

Closed
adilanchian opened this issue Apr 21, 2021 · 17 comments
Closed

"Non-Error promise rejection captured with value:" #3440

adilanchian opened this issue Apr 21, 2021 · 17 comments

Comments

@adilanchian
Copy link

adilanchian commented Apr 21, 2021

Hi all!

I didn't want to create a bug as I don't believe there is a bug here considering this error has been talked about a few times here. TL:DR - We are receiving a copious amount i these errors with no values provided. I can't see anything that sticks out in our code for why this is happening, but I don't want to dismiss this as an external factor. Some information about our Sentry Setup:

"@sentry/browser": "^6.2.5",
"@sentry/integrations": "^6.2.5", 
"@sentry/react": "^6.2.5",
"@sentry/tracing": "^6.2.5"
...
integrations: [new Integrations.BrowserTracing(), new ExtraErrorData()],

Was curious if anyone has any advice/thoughts on how to to begin debugging this further? Thanks in advance for your time!

@kamilogorek
Copy link
Contributor

Unfortunately, there's nothing we can extract from promise rejections that were thrown with an empty string. Even trying to "fake" an error doesn't provide a valid stack trace, as global error handlers are not keeping track of the callers.

e.g.
image

This event is produced in one of three ways:

async function foo() {
  throw '';
}

// or

new Promise((resolve, reject) => {
  throw '';
});

// or

new Promise((resolve, reject) => {
  reject('');
});

In order for us to extract the stack trace, rejections/throws inside async functions have to be done through an Error instance.

@wynnw
Copy link

wynnw commented Apr 28, 2021

This started happening to us on April 16th, on a day where we didn't change any code at all. Since them we've had 98k of these errors. We've added some code to filter this out in our js as we can't figure out a way to silence these at all. I'm guessing it's related to some password manager like lastpass as it only happens on our login page, with chrome, on windows 10. We've added code like:

            beforeSend: function(event, hint) {
                // filter out UnhandledRejection errors that have no information
                if (event !== undefined && event.exception !== undefined && event.exception.values !== undefined
                    && event.exception.values.length == 1) {
                    var e = event.exception.values[0];
                    if (e.type === 'UnhandledRejection' && e.value === 'Non-Error promise rejection captured with value: ') {
                        return null;
                    }
                }
           }

If there's a better way to deal with this, I'd love to know about it. On one hand, I can see how you don't want to editorialize here and prevent these errors, but when there's no info at all there's nothing actionable and we can't do anything about it other than be annoyed.

@adilanchian
Copy link
Author

@wynnw

Thanks for the insight here! Really helpful. We are having the same affected browser and device, but really can't tell where this is coming from.

@kamilogorek said it great where it is just returning an empty error object so not much Sentry can do here. Would be cool to know the origin of the error maybe? Not sure how this works with extensions.

Either way appreciate the insight!

@wynnw
Copy link

wynnw commented Jun 18, 2021

Adding an update for anyone else, this problem has evolved to be a "Non-Error promise rejection captured with value: Object Not Found Matching Id:5" error, so we had to update our hack to deal with that. We decided to just put the hack on the login page, as it appears this is from some password manager browser extension.

edwh added a commit to Freegle/iznik-nuxt that referenced this issue Jun 19, 2021
@m-bp
Copy link

m-bp commented Jun 21, 2021

We are also getting this error, both empty and now with the "Object Not Found Matching Id:" message. I want to point out that while we do not have a login page we do have forms all over the site and there's two characteristics that stick out:

  • Some of the URLs do not exist. Part of the path would be valid but the last part is just gibberish. ie: /blog/fashion/AWBM2HW instead of a real post's title. The random part repeats itself on different clients, it's not like every error has a different slug. This 404 page has no form in it.
  • Most other URLs are links sent through email to our clients. Too many of them for it to be a random coincidence. In fact the gibberish links from before are related to links we've sent through email.

It may be a completely different issue from yours @wynnw but who knows.

@abhishek1234321
Copy link

This is most likely happening due to the safe links being scanned by Outlook

If you have an Office 365 subscription and your emails contain links to your site and these links use Safe Links feature then it is bound to happen

We were able to reproduce this and get the error in Sentry

For details see this thread https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062

@kamilogorek
Copy link
Contributor

In the next version - 6.9.0 (releasing as we speak), Dedupe integration is turned on by default, which should lower the impact of this issue tremendously.

@michaelschufi
Copy link

michaelschufi commented Oct 29, 2021

Is there any way to disable sending those events to sentry? We are on 6.13.3 (Next.js package) and are seeing a very high number of such errors.

@kamilogorek
Copy link
Contributor

kamilogorek commented Oct 29, 2021

Sentry.init({
  ignoreErrors: ['Non-Error promise rejection captured']
});

or through beforeSend callback.

@lobsterkatie
Copy link
Member

lobsterkatie commented Aug 31, 2022

It's been a while, but this has come up again so just going to chime in here:

All of the above hacks work, but are broader than they need to be, and therefore risk filtering out unrelated events.

As Kamil said above, Non-Error promise rejection captured... is what we send when a promise rejects with something other than an instance of the Error class/an instance of an Error subclass. Most often we catch these once they hit the global error handler, but this can also happen if captureException is called explicitly on the rejected object (try { await asyncThing() } catch (err) { Sentry.captureException(err) }, where err is null/undefined/a string/some other random object).

Since this can happen in any number of different circumstances, if you want to filter the events mentioned above (empty rejections and rejections with the Object Not Found Matching Id message), better to actually filter specifically on those. (For that, you can use either the beforeSend code from @wynnw or the ignoreErrors code from Kamil. In either case, you'd want to use a regex rather than a substring match for the empty rejection so you can make sure it's empty, and a check on the actual error message for the Object Not Found.. rejection.)

As for the Dedupe integration Kamil mentioned, it will only help in cases where a) there is an exact match on message (so no varying URLs) and b) when no other error happens in the meantime (IOW, if you have error A followed by error A, the second one will be dropped, but if you have error A, error B, and then error A again, they'll all go through). This is probably why @michaelschufi was still seeing lots of these errors even after we turned Dedupe on by default. Filtering on the actual errors should make this a moot point, though.

Ultimately, the ideal solution would be to work with the Outlook folks to get them to not throw the error in the first place.

@michallepicki
Copy link

michallepicki commented Apr 24, 2024

In our case the error says now:

Non-Error promise rejection captured with value: Object Not Found Matching Id:5, MethodName:update, ParamCount:4

The Id seems to change from time to time, though.

MethodName and ParamCount seem to have been added in cefsharp/CefSharp#4209 ?

@simonmaass
Copy link

we can also see the following for example:

Non-Error promise rejection captured with value: Object Not Found Matching Id:5, MethodName:update, ParamCount:4

Non-Error promise rejection captured with value: Object Not Found Matching Id:5, MethodName:simulateEvent, ParamCount:1

@mydea
Copy link
Member

mydea commented Jun 13, 2024

I don't think there is much we can do about this, I feel like we give a reasonable amount of detail in this case now? This means that something like this is happening:

Promise.reject({ value: 'Object Not Found Matching Id:5, MethodName:update, ParamCount:4' })

In which case I'd say this is as reasonable a thing to capture as any? You should be able to filter this via ignoreErrors based on a regex: https://docs.sentry.io/platforms/javascript/configuration/filtering/#using-

@hiroshinishio
Copy link

Hi Sentry team,

This error and ticket is already closed but I am facing this error many times.

@sentry/nextjs": "^8.9.2"

How can I do? How did everyone solve?

@grygoriy-pinkas-scx
Copy link

cefsharp/CefSharp#4209

it still exist

@mydea
Copy link
Member

mydea commented Jun 24, 2024

Hi Sentry team,

This error and ticket is already closed but I am facing this error many times.

@sentry/nextjs": "^8.9.2"

How can I do? How did everyone solve?

As mentioned before, we simply try to build error messages from objects that we receive that are not actual Error objects. We can only do this by applying heuristics, and these can never be perfect. I'd encourage to raise this with whatever library/code that emitted this "error" to make sure to not throw POJOs or similar but to throw proper errors. If you do not want to capture these errors at all, you can configure ignoreErrors as seen here: https://docs.sentry.io/platforms/javascript/configuration/filtering/#using-

@ishields
Copy link

This is happening for us all of a sudden too. hiroshinishio or anyone have an example of a configuration that works? My issue adding an exception to the error handle is how can we be sure this doesn't happen in some other situation which is more critical than outlook crawling it. I'd hate to ignore the error now, and that have it actually impact users in the future and have no visibility into that.

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

No branches or pull requests