Comments (9)
Hello @swelham, can you make sure that useSessionSetupMethod
is correctly setup?
Are you still using mixins by any chance?
Could you try debugging what is causing the rejection? If I'm not mistaken, when ESA fails to setup itself / restore authentication it doesn't raise an error.
The error most likely comes from non-authenticated requests on other routes instead.
Are there any requests failing when it occurs?
from ember-simple-auth.
Hey @BobrImperator, I believe I have the useSessionSetupMethod
correctly set. I have specified the following in our ember-cli-build.js
file.
'ember-simple-auth': {
useSessionSetupMethod: true,
},
I have spent some more time debugging and I have been able to capture the error coming from the internal-session
module when restore
is called. As you mentioned, this rejected promise is caught in a try..catch
in the session
module.
Unfortunately, our error tracking sdk (sentry) still catches the caught error and reports it. I can configure sentry to ignore the error, but as it's just a generic Unhandled Promise
error we would end up filtering out all of these errors, potentially hiding a real bug in our app.
I am wondering if there is a way for the restore
function to throw a more identifiable error in this case?
from ember-simple-auth.
The session.setup()
shouldn't be returning any errors I believe, it already wraps anything that could potentially break and if they fail they do so silently.
You can try implementing your own try catch
around the session.setup()
in your application route and see if the error persists.
from ember-simple-auth.
Thanks, I have dug a bit deeper and found that when the promise fails, the error is still raised in the browser but as a caught exception. After some experimenting, I worked out that using a .catch()
on the promise would prevent this, meaning it doesn't get tracked by our error reporting.
For example, changing the restore part of the session setup function to something like this prevents the error from being raised.
await this.session.restore().catch(() => {
// Ignore errors when restoring the session
});
Would this be an acceptable change?
from ember-simple-auth.
I think that's correct.
Though I'm not exactly sure how sentry manages to get this error even though it's already caught and hushed out internally by ESA.
It doesn't appear in browser console for me at all, meaning that it's not being thrown by Ember.onerror
if I understand this bit of Ember correctly.
From the looks of it, it seems like sentry is getting the errors in some different way than hooking into Ember.onerror
.
from ember-simple-auth.
Yeah, I believe sentry is doing something lower level as I think it's more of a generic js SDK than ember specific. I also don't see the error in the console unless I enable break on all exceptions including caught exceptions.
from ember-simple-auth.
@swelham Could you let me know what version of sentry you're using and which package?
from ember-simple-auth.
Sure, we're using "@sentry/browser": "^6.16.1"
and "@sentry/integrations": "^6.16.1"
in our app right now.
After some more debugging I noticed in the internal-session.restore
function, where the reject is specified, there is no error passed into the call to reject
(ie const reject = () => RSVP.Promise.reject();
vs const reject = () => RSVP.Promise.reject('some error');
. I believe this function expects to receive an error reason when called and appears to have a different behaviour when it isn't given.
I tried the code, specifying a hard-coded error reason with the try catch
approach I was able to produce an uncaught error and see it in the console. However, when chaining a .catch(() => {})
to the call to restore
the error was handled and not raised in the console.
I feel like there is a subtle difference in how these two error handling approaches are working with the promise rejection and it only becomes clear when using an error reason.
from ember-simple-auth.
@BobrImperator is there anything I can do to further assist on this issue?
from ember-simple-auth.
Related Issues (20)
- CookieStore is not initializing/syncing correctly HOT 2
- Dependency Dashboard
- CookieExpirationTime not being set HOT 2
- When syncing tabs (session store), schedule of the refresh token should be updated
- ember-polyfills.deprecate-assign deprication in Ember 4.4 HOT 2
- Action Required: Fix Renovate Configuration
- ESA's Application route hides host app's route when using pod layout & embroider HOT 5
- Access token does not persist HOT 1
- Neither of test apps work - did you stop maintaining it? HOT 1
- Missing deprecation guide for session events HOT 1
- test-app should use modern Octane syntax
- Invalidated immediately after authentication when using cookieStore with Safari HOT 8
- Ember v5 - current ember-canary, ember-beta channels are failing under fastboot HOT 1
- Incompatible with Ember 5.0.0 HOT 19
- [Embroider] Fails under fastboot in embroider-optimized scenario
- API documentation still at version 5.0.0, but current release is 6.0.0
- this.session.requireAuthentication is returning false on a page refresh, even though user is already authenticated HOT 10
- ember-simple-auth is using its own copies of peer-deps like RSVP HOT 2
- CookieStore SameSite warning in Firefox
- Error: Could not find module `ember-simple-auth after updating to 6.0.0 in a V1 addon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-simple-auth.