-
Notifications
You must be signed in to change notification settings - Fork 472
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
Error: database is destroyed #612
Comments
I wanted to open a new issue but I think this is the same issue. Was trying to follow along the hoodie tutorial and I got to the signUp and signIn example. Copy pasted the example code and this is what I got: hoodie.account.signUp({username: 'Robin', password: 'secret'}) returns {outcome: { id:"0k4dgh7", username:"Robin"}, ...} and hoodie.account.signIn({username: 'Robin', password: 'secret'}) returns { outcome: "Invalid credentials" , ...} and status |
@GreenGeorge that’s a different issue. Could you create a separate issue on this repository to keep the thread here on the original issue? What tutorial did you follow? Can you run |
@gr2m will do |
@gr2m I must say I could not reproduce the error with your code. I started a new app just like described here, then I put your code on a new script tag in
Am I doing something wrong?
|
@brunopedroso do you use CouchDB as the backend? Did you use |
No, I tested it without couchdb. Just pouch and fs in a freshly created app. |
I upgraded node, npm and hoodie and keep seeing the same 401..
|
I added a
|
And it seems to be right here. |
I can see a request header in chrome console: |
Hmmm... Looks like a versions issue.. |
is this dependecy right? |
Actually, I see 2 different versions of account-client here:
|
yeah! could finally reproduce the error hacking hoodie-client module and rebuilding it poining to [email protected]. Maybe we should open another issue for this dependency problem? |
I could reproduce it without the findAll and the signup:
I see the logs 1, 2 and 3. then 'db is destroyed' |
and by the stack I can see the error occurs when |
ops.... Looks like the version of reset I have here is also not up-to-date... I'm running this one. =/ |
hm... looks like its the same problem? =/ |
Well, I could hack the module again, updating the dependency and looks like its a bit better... If I comment out the If it but back the |
WOAH this is at version 5 how did that not get updated. Did you try if updating it fixes the problem? |
its defined like so in master of hoodie-client, look: https://github.com/hoodiehq/hoodie-client/blob/master/package.json#L12 |
I’m looking into it thanks |
@gr2m I dug it a lot today and guess I found the problem. the
or
This approach seems to be incompatible with the way It works in 'uscoped' api, when we call store's members, because they've been correctly replaced. But it cannot replace the I tried some hacks to overcome this, but it seems to me it's not the right way... Maybe we could just use instead:
Its not the best api but it would work properly with what do you think? does it make any sense? |
Thanks for looking into it. The reset method is way overdue for a proper cleanup, it’s quite messy. I’ll take the opportunity to do that over the weekend, I’ll keep you posted what I found out, maybe I find a way to work around all this |
just a quick update, I tested the code in the latest hoodie with all submodules up-to-date, the issue is not yet fixed, I’m looking into it |
okay I understand the problem now, took me a while :) This line is what’s not working, we can as well just leave it out here, it won’t make any difference. I think what I would do is to keep the current PouchDB instance in an internal state and pass the internal state. For that we would have to merge The dedicated var todoStore = store.scoped('todo')
store.reset().then(function () {
todoStore.findAll()
}) Passing the internal state on which we can set the PouchDB database instance would though. Any thoughts? |
lots and lots of updates in Hoodie land, but didn’t yet get to this one. I had some thoughts though on how we cam resolve this problem properly, it’s on my list, I won’t forget! Sorry this takes so long! |
No problem. Thanks! I must take some time to review your last comment as well. Sorry. Will try to do this asap. |
@gr2m , I read your last message with attention now. Just to check if we're in the same page: when you say 'this line is what's not working', actually the Concerning the solution I proposed, in fact, the code you imagined would not work, because the
But, for sure, if someone retains a reference to the scoped apis, that wont work agian. Concerning your suggested solution, I'm not sure if I fully understand what you mean by 'passing and keeping the internal state', so I'm not able to comment. Maybe you could sketch some sample code? I also cannot say if merging |
@brunopedroso hey Bruno, I’d love to hear your thoughts on this discussion regarding the |
Friends, any news on this one? |
I get this error if I have the user logged-in to my app and later logout and then try to add data without being logged-in. If I refresh the app/url before adding new item it doesn't happen |
news: |
@gr2m @brunopedroso did this fix made it into I have a prefixed store created like this If I log out, log in again and try to use it, I get the |
I'm sorry I don't know, it's been so long :( I think I didn't finish the work for it. If you want to give it a look, I can review your pull requests, but not much else I can do right now, given my time constraints |
I see, I'll try to dig into this a bit more since it seems like the structure changed a lot since this PR was created |
We have a problem with sign in / sign out / sign in again and the scoped store API. Here is a script to reproduce the bug
I looked into it but could not yet figure it out. Thanks to @brunopedroso who found the error
The text was updated successfully, but these errors were encountered: