-
-
Notifications
You must be signed in to change notification settings - Fork 593
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
"_synchronizeAllAuthData is not a function" when running in production after 2.9.0 update #992
Comments
I had this issue today, it only occurred once i deployed the code to a docker container, running locally on the React webpack dev it didn't happen. Specs of the failed system were Parse-server 2.9.0 Error thrown was With a fresh browser you could call the login and make queries, on refresh it would throw the error until you clear the localStorage. |
So we also only saw it after we actually deployed the code but, after further investigation, we found that it was related to the NODE_ENV variable which, when serving the app locally, defaults to "development". I only can confirm this with Vue but I'd be curious if you get the same error locally if you set your mode to production when running it locally.
… On Nov 11, 2019, at 1:02 PM, jamesmogg ***@***.***> wrote:
I had this issue today, it only occurred once i deployed the code to a docker container, running locally on the React webpack dev it didn't happen.
Specs of the failed system were
Parse-server 2.9.0
Express 4.17.1
node v12.13.0
Alpine Linux
React 16.11.0
Error thrown was
"_synchronizeAllAuthData is not a function"
With a fresh browser you could call the login and make queries, on refresh it would throw the error until you clear the localStorage.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Getting the same error in production: TypeError: t._synchronizeAuthData is not a function at Uncaught (in promise) Error: XMLHttpRequest failed: {} |
I am getting something similar, not sure if related. This happens in a production build of an iOS app, regardless if deployed on device or simulator.
I extracted line 519 from the bundle, on column 4087 (marked below with "<---") is the following method:
I downgraded to 2.8.0 and issue is now gone. |
Hey guys the issue is caused by #978 Looks like this doesn't like minified code (ParseUser doesn't exist as it has been minified to a variable like 'e'). We could revert this or someone can try a PR. |
I opened a PR #999. Can you see if it works for you? |
Can confirm, PR #999 fixed the issue we were seeing. |
I've updated to |
@RaschidJFR did you try clearing your cache / refresh the browser? |
Same problem even in different browser and incognito mode |
@RaschidJFR Are you receiving the same errors as above? Also are you using a Parse.User subclass? |
I was indeed using a subclass in my Ionic app, but even without it the error persists. This simple block: Parse.initialize(environment.parse.appId, environment.parse.javaScriptKey);
(Parse as any).serverURL = environment.parse.serverUrl;
Parse.User.current(); throws this errors:
|
Can you debug the currentUser function? I do have an ionic app. I’ll try to replicate this. |
Same here. I upgraded to I am using a subclass for The error is thrown here, var current = _ParseObject2.default.fromJSON(userData);
// After this call, current doesn't have the _synchronizeAllAuthData function
currentUserCache = current;
// and so it crashes here:
current._synchronizeAllAuthData();
return current; |
FYI, I found a fix for my specific issue. I was subclassing Parse.Object.registerSubclass('_User', User); At boot up,
Parse.Object.registerSubclass('User', User); // no underscore
Parse.Object.registerSubclass('_User', User); // left this one too, just in case Hope this helps anyone out there with this issue. |
@josenriq thanks for reporting a fix. I can do a PR that will register to both User and _User. |
@josenriq This was brought up. parse-community/docs#680 (comment) Im against overriding the _User subclass, but it seems like a lot of developers are doing it. |
@RaschidJFR Quick question how are you subclassing your Parse.User and registering it? Is it 'User' or '_User'? Can you see if the fix above works for you? |
I always use @josenriq thanks for having a look at the issue. I’ll try your solution. |
I'm afraid this issue keeps happening for subclassed For example, in an Angular project, unless you eject the configuration or install a custom builder to intercept Terser and keep class names, the following code breaks: https://github.com/parse-community/Parse-SDK-JS/blob/master/src/ParseUser.js#L874 json.className = user.constructor.name === ParseUser.name ? '_User' : user.constructor.name; because |
@dplewis what do you think about
instead of
|
I confirm that from |
"parse": "^2.13.0", |
Issue Description
After updating to Parse 2.9.0, we started noticing a new error when running
Parse.User.current()
, but only when running in production. Downgrading to 2.8.0 fixes the issue. The error thrown is:Steps to reproduce
NODE_ENV=production
)Parse.User.logIn
methodParse.User.current()
Expected Results
Should return a Parse.User object with the current user.
Actual Outcome
Throws error: "_synchronizeAllAuthData is not a function"
Environment Setup
Server
JS SDK
Logs/Trace
The text was updated successfully, but these errors were encountered: