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

Cannot fetch user based on address in paratii config #582

Closed
bent0b0x opened this issue May 16, 2018 · 11 comments
Closed

Cannot fetch user based on address in paratii config #582

bent0b0x opened this issue May 16, 2018 · 11 comments
Assignees

Comments

@bent0b0x
Copy link
Contributor

bent0b0x commented May 16, 2018

Problem
This line is supposed to get us the user object, including things like username (which is important for saving usernames on videos when you publish).

However, this promise always resolves with null even when passing the address currently stored in paratii.eth.getAccount() (at least in my repeated testing today).

Perhaps @geckoslair or @jellegerbrandy know what might be going wrong?

@bent0b0x bent0b0x changed the title Cannot fetch user Cannot fetch user based on address in paratii config May 16, 2018
@bent0b0x
Copy link
Contributor Author

bent0b0x commented May 19, 2018

I dit a bit more investigation, and the reason this was not working is because the paratii.users.create promise is taking ~30 seconds or more to resolve (at least locally), implying that the user can take that long to be created. Thoughts on why this might be the case?

@bent0b0x
Copy link
Contributor Author

bent0b0x commented May 30, 2018

FYI I can still reproduce this consistently locally. I have secured my account, but whenever I load the app and enter my password paratii-js cannot load my user.

To reproduce, set a breakpoint on this line and it is never hit, beacuse user is always null here.

I also see that updating username and email, at least locally, does not persist. I have the db running seemingly fine.

@jellegerbrandy
Copy link
Contributor

jellegerbrandy commented May 30, 2018 via email

@bent0b0x
Copy link
Contributor Author

bent0b0x commented Jun 1, 2018

I now have another concerning issue. Every time I try to save user data via paratii.users.upsert() I get this in the db logs, and the db crashes:

/Users/benjaminbaum/Desktop/dev/paratii-db/node_modules/mongoose/lib/utils.js:429
        throw err;
        ^
MongoError: E11000 duplicate key error collection: test.users index: username_1 dup key: { : null }
...

@jellegerbrandy
Copy link
Contributor

@geckoslair , do you have a quick fix for the error?

@geckoslair
Copy link
Member

geckoslair commented Jun 1, 2018 via email

@jellegerbrandy
Copy link
Contributor

@bent0b0x , one possible explanation could have been that users.create did nto work because the transaction was not set unsigned (in that case, parity will wait for you to sign it in the UX). I did some refactoring in paratii-js that makes this situation less likely, let me know if it helps...

@bent0b0x
Copy link
Contributor Author

Sounds like that could be it. Is this change on dev? Either way I’ll test soon locally!

@geckoslair
Copy link
Member

still have this issue?

@bent0b0x
Copy link
Contributor Author

bent0b0x commented Jun 18, 2018

Yes, this is happening on staging.

Steps to reproduce:
- fresh portal page
- create new account, finish flow in the modals
- go to profile page

You'll see no username in the profile, and this is because the user is coming back as null via paratii-js

I think I have figured out the issue.

@geckoslair, does the db enforce that usernames be unique? If so, this doesn't seem to be surfaced via paratii-js. If you try to save a non-unique username, paratii-js throws no error. However, the account is not created.

We should fix this, meaning we need an explicit error code of some sort if a username is already taken so that we can show messaging in the UI and try to create the account again.

@bent0b0x
Copy link
Contributor Author

Created this issue in paratii-js

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

4 participants