-
-
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
Error 206 cannot modify user for new Facebook user #6511
Comments
I'm having a similar issue too - perhaps related: |
@henrytkirk Can you open a new issue and fill out the template. Any logs or sample code would help. |
@ashish-naik Can you try facebook login on the backend with masterKey: true? |
I am not using cloud code for login. Call from swift code. |
I wanted you to try it and see if that would fix this If login is successful does your current user have a sessionToken? To change a user you need to have permission to do so. |
I will try. May take some time due to workplace priorities. Yes sessionToken is nil after successful login. |
@dplewis I tried below. Not good with cloud code so hope code is not wrong. Cloud function
ios Code
Server log
if i run code for a registered user without master key, i get sessionToken printed in logs. But i am getting undefined for sessionToken for user.sessionToken or user.getsessionToken. Moreover, in Xcode i get PFUser.current as nil. Does above help? |
@dplewis Did you get a chance to look at my code? Hope you are safe and doing well in this difficult times. |
I can look into it, can you open a similar post in the iOS SDK? |
@dplewis I had opened 1477 post awhile back for Sign in with Apple. The symptoms are same as Facebook login issue that i created for you to look at. I have added some details of investigation there but realized it is marked closed. Can you please have a look? Should i remove the details from there and repost here? |
@dplewis did you get a chance to check? Although you asked me to open this issue in iOS SDK repo (which i did, linked above), i think this has to do with server. I am stuck at this since many days. Really appreciate if you could take a look. Today i tested on local server on my Mac with same config as Heroku ie it worked on local but didnt on Heroku. I noticed that this.storage['authprovider'] is undefined in createSessionTokenIfNeeded to createSessionToken() isnt called.
|
Some more logs from RestWrite.js from Heroku. I noticed that validateAuthData is called twice. First time findUsersWithAuthData finds nothing and sign up fails. Message - before return this.getUserAndRoleACL() |
I had opened a post in under iOS but seems the issue was at server side. When findUsersWithAuthData returns no result which means this user had not signed up earlier, below handleAuthDataValidation block handles auth validation and returns success since it is a valid auth.
But in this flow, this.storage['authProvider'] is not set so below if statement in createSessionTokenIfNeeded evaluates to true and returns without calling this.createSessionToken().
So i tried this fix
to just before it. After this change sign up with facebook and login both worked, sign up and login with email also worked. I have not added function for linkWith in my app so cannot test it yet. is this is a valid solution? I tried to request you to check on iOS post but didnt get response hence raising again. -Ashish |
Hello Can someone check this please? |
@mtrezza when is this bug likely to be prioritized? |
This thread has quite a potpourri of information. I suggest to simplify and restate the issue as a comment, using the issue template, including:
I am also reclassifying this issue as "needs more info" until we can confirm that this is actually a bug. |
@mtrezza i tested on local as well as Heroku with v4.4.0 and found Facebook login with new user is still failing. Issue Steps to reproduce
Log
I cannot provide Parse Server log because somehow i am not able to enable even after setting VERBOSE=1 in heroku config vars. (this is another issue i can't solve) Environment SetupServer parse-server version (Be specific! Don't say 'latest'.) : 3.9.0 to 4.4.0 (Local 4.4.0) Database MongoDB version: MongoDb Atlas Sandbox cluster 4.2.10 (Local 4.2.3) Parse iOS SDK 1.91.1 I don't login using cloud code so below is iOS code. iOS Code snippet for Facebook login
index.js
package.json
The code change i have tried and that works is in above comments. Thanks |
Thanks for the details. Can you please reduce the iOS code to a minimum example by removing all code that is not necessary to reproduce the issue? Then, in that minimum example, at which step in the iOS code does the server log |
sorry forgot that method where error occurs actually.
|
Can you please reduce the iOS code to a minimum example by removing all code that is not necessary to reproduce the issue? |
I haven't tested this but removed all non-essential part.
|
could you please try to pass down the |
i tried to debug further by stripping down those methods. Earlier i had After loginWith call, a row is created in User object (authData (id and access_token not nil) and username attributes are updated) and below is state of loggedInUser
If i assign value to email attribute before save call then fails with error 206 but save is successful if email is not updated. Please see below code.
|
Thanks for reducing the code, this is interesting indeed. I will try to reproduce this issue. |
Hi, were you able to reproduce? |
I tested with v4.10.4 and still getting the issue. Could this be looked at please? |
@mtrezza Getting this on 5.4.0 also. Cna you please take a look? |
Is this a Parse Server or Parse SDK issue? Could you give a short summary of where we are on this issue? |
It is server issue. I had am using fixed code in my instance. Explained here. |
If I understand correctly, you discovered the bug using the Parse iOS SDK, but you determined that the bug is actually server side. So let's focus on the server. Could you open a PR with a test that demonstrates the issue? The SDK is just sending a REST request, so the issue should be replicable in a test. Then, when we have the failing test, could you add your fix to the PR to show that the test does not fail anymore. Then we can merge the fix. |
I am afraid I don't have skills to write tests ! But i forked the repo here and made the same change mentioned above to RestWrite.js. Facebook new login is working after that. |
If you would like we will guide you to write a test, it's fairly easy. You can just copy an existing test and modify it. In any case you could open a PR against the alpha branch here, so others can see what changes you made. |
Sure, i am ready to try. Please guide me. Please guide me abt opening PR too. This is first time as well. |
Sure, please take a look at the New Contributors Guide. A step that is different there though is that the new branch is not created based on the @dblythy How can that blog post be updated? |
okay so i cloned the repo, created new branch and created a test as below (from 'test facebook signup and login') However, the test ran successfully. Environment on my Mac is same as test instance on DigitalOcean App Platform. Same issue was on Heroku also. i am not using Heroku now but DigitalOcean uses Heroku build pack for node docker image. Only difference is parse server is 6.alpha and not 5..x.x
output
|
Realised setting verifyUserEmails was incorrect. tried below but gives error
|
On which line does it throw that? |
Line where PublicServerURL is mentioned. |
I fixed the error by adding adapter constant. The test passes successfully so wondering why actual code is failing and work with my fix explained above.
|
I got error on version 5.5.4 also. I haven't changed my app's login code. However don't get error if i run on my Mac that has same version of Parse Server, NodeJS, npm as on Digital Ocean. |
What version of Parse Server are you using? If this issue cannot be reproduced on Parse Server 6, we'll go ahead and close this issue, since PS5 doesn't receive any support anymore other than security related issues, and even that only 4 more months. |
Upgraded server to 6.2.1 and still got error. On local. Works if By the way, unrelated question but running this in index.js fails. Asking because i am not able to deploy on Digital Ocean so unable to test. Appreciate if you can point the mistake. World in prior to v5
|
Correction : I get error irrespective of value set for |
This thread has gotten quite long. I'd suggest to first identify whether it's a Parse Server, Parse SDK, or non-Parse issue. To do this let's boil this issue down into a failing test in a pull request, using the Parse JS SDK. The test should also help others to understand the issue. It seems you have already written a test. Please try to further reduce the test if possible and remove any code or special config that is not necessary for the test to fail (like email adapter, etc.). Use the standard APIs of the Parse JS SDK, no REST APIs. Don't reconfigure the server if not necessary, or reconfigure only with the options you need to change. Use async/await syntax, no chained promises. Please take a look at other auth-related tests how they are written and adapt for your issue. We will then see in our CI with a plain Parse Server config whether this is reproducible. |
I ran the test under server on latest version and it ran without failing. My original test also succeeded. Worked after removing all additional config too. I cloned JS SDK, ran the default tests.
|
Could you please open a PR and try to make the changes suggested in my previous comment? Some suggestions are not test specific, like using away/async instead of chained promises and removing code that is unnecessary for the failing test. We can then continue the discussion in the PR to adapt the test. If we cannot reproduce the issue, we cannot investigate this issue further and we have to assume a custom configuration on your side being the cause for this. |
Created PR #8737 |
…p to test error 206 raised in parse-community#6511
Hello
I am getting error 206 after new Facebook user is saved and reason seems to be nil sessionToken.
I am facing this for Apple sign in also randomly. This is probably getting fixed by #6416. Don't know whether Facebook issue will also be fixed.
I have one old account created on Heroku Parse server which works fine ie i am able to save attributes after login.
I was running server v3.9.0. tried upgrading till 4.0.2 but still failing.
I am updating PFUser object post login locally in iOS client using Swift. Not using cloud code for this.
Also failing on back4app v3.9.0. Sign in with Apple also failing on back4app but works randomly.
Works on local setup consistently. Local server installed using bootstrap.sh script.
I have seen some issued dated 2016 fixing this error but server code seems to have changed lot so cannot view the same code referred in #952
using FBSDKCoreKit 5.15.1, FBSDKLoginKit 5.15.1
Steps to reproduce
on iOS, Try login using a facebook account that is not yet created on Parse.
Running iOS 13.3.1
Expected Results
After successful login, should be able to save other attributes in PFUser.current() object
Actual Outcome
The login is successful but saving any attributes fails with error 206 "cannot modify user xxxxx"
Fails on back4app also. v3.9.0
Both Apple and Facebook new user registration and update work fine in local environment.
Environment Setup
Server
Database
Logs/Trace
Mar 15 02:51:40 yovl app/web.1 error: Parse error: Cannot modify user kc30Xbk1wA. {"code":206,"stack":"Error: Cannot modify user kc30Xbk1wA.\n at RestWrite.runDatabaseOperation (/app/node_modules/parse-server/lib/RestWrite.js:1170:11)\n at /app/node_modules/parse-server/lib/RestWrite.js:127:17\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"}
package.json used for deployment to Heroku
auth section in index.js
The text was updated successfully, but these errors were encountered: