-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
401 unauthorized firing 'complete' instead of 'error' or 'denied' #4276
Comments
Can you describe the situation a little more? I believe this may be due to the fact that replication can reject writes with a 401 and replication will carry on by design, people may have a You mentioned the denied event, that is supposed to be fired in this situation are you not seeing it? a 'denied' event isnt a completion one and the complete event will still fire after denied does |
As a security feature, when a user logs out I remove them from the _security doc of their database. This means that replication will fail with In contrast, a validate_doc_update failure should result in I am listening for the 'denied' event but it does not fire in the case of |
So I did a bit of further testing. When PouchDB live replication receives an When a normal |
By the way, here is the source code that I'm working on that sets up 3-way sync and tracks events... |
@colinskow It seems like you are wanting to get your bugs fixed fairly quickly and fixing them yourself, so thanks :), and leaving these here in case you are looking to take a look at this (or anyone else) https://github.com/pouchdb/pouchdb/blob/master/tests/integration/test.retry.js#L543 Is a test that overrides the We dont trigger |
So I wrote a test for this, however fixing it is tricky, we have some not so perfect state handling code in the replicator so I may need to do a few refactorings before getting to the fix |
Leaving this open unless @daleharvey thinks 31cdcf8 solves the original issue. |
Yup this fixes the issue, previously |
I just wanted to check whether this fix has gone into latest i.e. 5.3.2 release. I'm still seeing the same error in 5.3.2. |
Reopening since apparently 31cdcf8 doesn't solve the issue. |
@srikanth235 do you have any further information on the issue you are seeing? we identified the bug and landed the fix with a passing test so if you are seeing something related broken it would help to know exactly what that was. Thanks |
So, I guess I'm not clear as to what should happen when my session with couchdb expires as it relates to a live sync that is currently happening. Should that only fire the "complete" event or should it also fire an "error" event? I'm not sure that the docs are completely clear there. Or I missed something in the docs... |
@coderroggie 401/unauthorized should fire the "denied" event. |
Closing as a dupe of #5172 |
I want my app to send the user back to the login screen when a live replication fails due to a 401 unauthorized response.
Based on your documentation: "In a live replication, only cancelling the replication should trigger this [complete] event." I would expect this to be handled by either 'error' or 'denied'.
With the 'complete' event, I have to iterate through the errors on both 'push' and 'pull' properties to tell if an unauthorized occurred... more complicated than it should be.
The text was updated successfully, but these errors were encountered: