-
Notifications
You must be signed in to change notification settings - Fork 678
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
TypeError: Cannot read property 'config' of undefined when request is aborted #161
Comments
I have the same issue... |
I have the same problem if the request is aborted for example if the server returns a ERROR 500/ Status Code:500 Internal Server Error Then the: response is undefined and the loading bar is stuck near the end of loading. You can easily simulate it with making a $http request to a service that responds with error 500
the quick and ugly fix for it would be to change response to:
The best would be maybe to change the color of the bar to red or something for a few seconds but that is the decision of the project owner |
Same here. It would be a problem, apart the fact that it blocks protractor e2e testing, because it looks like protractor keeps waiting for angular to finish, but it will never finish |
In my case, the problem looks coming from an other interceptor (in the appe there are 2 interceptors). The problem was that an interceptor was not returning a promise if a condition has been verified |
Same issue here : I have another interceptor that cancels some resquests
My fix for loading-bar.js would be :
the timeout allows the loading bar to appear and load which doesn't happen without it because of the sync call. Would you consider a PR for this ? |
See: #50. You have a misconfigured interceptor. |
Yep-- sorry for the delay on this. Been really busy on a big project at work. @lord2800 is correct. I'll push the new release today that has a check for this |
This is not yet resolved? I am still getting error on latest version of this lib and Angular 1.6.2 |
@chieffancypants How I understand the docs, it's allowed to return a promise or a promise rejection from both
Unless I'm misunderstanding what previous interceptor means in this context, it seems valid to return a rejected promise inside a Here's a fiddle demonstrating the problem. The use case I have, is to prevent requests that would cause a 401 error due to being signed with an expired token. I verify the token on the client side, and the natural way for that check is to be in an interceptor, which works unless I add |
when http request is aborted response.config is undefined and ignoreLoadingBar is accessed without checking if response.config is not null in request, response and responseError handlers
'response': function(response) {
if (!response.config.ignoreLoadingBar && !isCached(response.config)) {
The text was updated successfully, but these errors were encountered: