-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
request.user is not up-to-date #1836
Comments
We have lots of passing test cases that cover these features. Can you post some code that reliably reproduces your issue? Ideally as a test case we can add to our test suite. |
I'm sure the code above reproduces this issue reliably. I've tested it many times, and the self-hosted server return the old value until I force quit the app and restart it. |
What version of Parse Server are you using? How are you updating the user? Are you sure everything is configured correctly? These things matter. For requests like these we usually ask for complete reproduction code from start to finish because it is quite common for someone to think they've found a bug, then when they try to make a complete test case they realize they misconfigured something somewhere. I might have suspected that this is a caching issue, but our cache TTL is 5 seconds by default, and it doesn't sound like you are only seeing this issue for 5 seconds. |
Please let me know if I can provide any useful information. Thanks. |
Does the error still happen if you use a self-hosted Parse Dashboard or an SDK to change the value? Does it still happen if you disable the cache or set the TTL to, say, 0 or 1 seconds? @blacha this error looks a lot like a caching issue, any thoughts? |
I tried modifying the value by REST API to both servers (parse.com and self-hosted), but the value I got from Android app didn't change. Here are the steps what I've done:
I can't find out the way in the documentation to disable the cache or set TTL. Can you give me a link or show me how to do that? Thank you! |
I'm trying this myself and not seeing the issue. Can you please tell me how to reproduce this issue starting from nothing? No Parse.com apps, no self hosted server, etc. I suspect there is some problem with how you've configured your database, or your Parse Server, or your SDK. The dashboard uses the same Javascript SDK as the open source one, so if the dashboard is working, then I'm sure the SDK will work too. Try enabled verbose logging with |
Actually, I'm not sure that I can reproduce this issue from nothing, since it's a migrated app. I'll give it a try later and report back, but before that, is the following code & results providing any useful information? Let's say the data is "A" at the beginning. I uninstall and reinstall the app, and call the function. The result is:
Now I change the value from dashboard to "B", and call the function again, the result becomes:
Here is the code:
Thanks. |
OK, I think I see the cause. It seems like the issue is that we don't fetch the user from the database when calling a cloud function, we use the one provided in the request. I'll double check the behavior of Parse.com and then submit a PR to match the issue in Parse Server. |
Fixed by #1844 |
…ixes #1836) (#1844) * Cache users by objectID, and clear cache when updated via master key * Go back to caching by session token. Clear out cache by querying _Session when user is modified with Master Key (ew, hopefully that can be improved later) * Fix issue with user updates from different sessions causing stale reads * Tests aren't transpiled... * Still not transpiled
…ixes parse-community#1836) (parse-community#1844) * Cache users by objectID, and clear cache when updated via master key * Go back to caching by session token. Clear out cache by querying _Session when user is modified with Master Key (ew, hopefully that can be improved later) * Fix issue with user updates from different sessions causing stale reads * Tests aren't transpiled... * Still not transpiled
I have a simple Cloud Function:
And a simple function call from Android SDK:
Let's say the value "data" of my User object is "AAA". I call the function from Android SDK. Parse.com's server and self-hosted server both return
user.get('data') = AAA
.Now I change the value of "data" to "BBB" from Dashboard, and call the function again. The results are different. Parse.com's server returns
user.get('data') = BBB
as expected, but the self-hosted server still returnsuser.get('data') = AAA
.Is it a correct behavior of the new Parse-Server or is it a bug? And if it's a correct behavior, how can I get the up-to-date data of request.user. Thanks.
The text was updated successfully, but these errors were encountered: