-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
_PushStatus issue after upgrade to 3.1.x #5161
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
Comments
Do you happen to have by any chance an _PushStatus object in your _SCHEMA table? |
Yes I do. Parse Server automatically generated this object in version 3.0 Should I delete it instead? |
I tried to delete this object and got another error instead. warn: Unable to ensure uniqueness for user email addresses: MongoError: Index with name: email_1 already exists with different options |
What version were you running before upgrading to 3.1? The alert you’re seeing is regarding the _User table. |
From 3.0.0 Everything works fine in version 3.0.0 |
I am running parse-server 3.1.0 and also see similar warning when I start up parse-server (npm start). Warnings on 3 index:
Is there any need to re-create the index on _User table when upgrading to 3.1.0? warn: Unable to ensure uniqueness for user email addresses: MongoError: Index with name: email_1 already exists with different options |
Are you able to provide the indexes from mongo perspective? We may have inadvertently mis implemented a feature in 3.1 |
@flovilmart, I believe these are the 3 indices. First two on _User and the last one on _Role. { { { |
According this this thread, you might have added unique constraints in 3.1.0. |
Would you be able to start a parse-server on a clean DB, and tell me what what do the indexes look like? |
I have migrated my DB from parse.com since 2 years ago. I didn't know how to start from a clean DB. Could you point me to some documentation on this? I will try again about 12 hours from now. :-) |
Just start a local mongo database. Look into the starting guides on the http://docs.parseplatform.org website |
Might have a solution to this. We got the same error: The issue was that we had an index |
I created a blank local database and started parse server connecting to the local database. It automatically creates the _User, _SCHEMA, _Role with indexes. This is the mongod log with schema and indexes details.
|
Ok so the main issue is that now we create the indexes as unique + sparse, as you initially envisioned. Now I am not sure of the best resolution:
What do you think? |
Is "sparse" is used when a field could be left as "undefined". Are these 3 fields optional? If the "sparse" is required, I suggest to delete and replace the index upon parse-server start up. Does parse-server has sufficient right to drop index? We should not leave unused Index because indices took up precious disk space and cpu time. |
Yeah, they do, temporarily, we could create the new one and replace the old one. Is it something you’d like to implement? |
The best way to give back when you receive a favour is to contribute code :-) However, I am not so sure at the moment. Let's me explore a bit further on parse-server codebase. |
There is a workaround, and the setup is not completely broken. You could destroy your indexes and restart the server this would ‘just work’. But not as clean as doing a migration. And as a long time user (as you said), it’s always good to have his hand dirty :) |
It works. I have dropped these indices and then new indices automatically created in next parse-server restart.
Recreated index on _User { Recreated index on _Role |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am a little late to this party and have just started upgrading from 3.0.0 to 3.1.x and have this issue. How do I go about fixing this issue? |
@jc73300 did you try what @nebitrams suggested? Sent with GitHawk |
I am unsure how to do what he suggested. |
You just need to delete the existing index, and restart the server, the new indexes will be created automatically. Alternatively, one could open a PR so we name the index so it lifts the conflict Sent with GitHawk |
Maybe the issue is something else. I have verified the indices are what they should be according to nebitrams. Every time I try to deploy 3.1.0 I get the following in my logs.
2019-02-03T20:36:28.475Z - Uncaught internal server error. TypeError: Cannot redefine property: _PushStatus
at Function.defineProperty (<anonymous>)
at SchemaData.volatileClasses.forEach.className (/var/app/current/node_modules/parse-server/lib/Controllers/SchemaController.js:530:14)
at Array.forEach (<anonymous>)
at new SchemaData (/var/app/current/node_modules/parse-server/lib/Controllers/SchemaController.js:529:21)
at getAllClasses.then.allSchemas (/var/app/current/node_modules/parse-server/lib/Controllers/SchemaController.js:654:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7) TypeError: Cannot redefine property: _PushStatus
at Function.defineProperty (<anonymous>)
at SchemaData.volatileClasses.forEach.className (/var/app/current/node_modules/parse-server/lib/Controllers/SchemaController.js:530:14)
at Array.forEach (<anonymous>)
at new SchemaData (/var/app/current/node_modules/parse-server/lib/Controllers/SchemaController.js:529:21)
at getAllClasses.then.allSchemas (/var/app/current/node_modules/parse-server/lib/Controllers/SchemaController.js:654:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
2019-02-03T20:36:03.702Z - Unable to ensure uniqueness for role name:
2019-02-03T20:36:03.700Z - Unable to ensure uniqueness for usernames:
|
what bugs me is that the version 3.0.0 is also creating sparse indexes and your indices look right in the DB. Would you have access to the mongodb logs, or runinng VERBOSE=1 with the version 3.1.0 and provide the full logs? |
I turned on verbose, what do you need? |
The logs on startup Sent with GitHawk |
Does this help? 2019-02-04T01:46:16.823Z - RESPONSE from [GET] /parse/serverInfo: { |
Stupid question, can I just copy _Installations and any of my own tables to a new clean db or will it break everything? |
What I am looking for is the actual error. As for why the index creation failed. Can you check the MongoDB logs? Sent with GitHawk |
I don't have access to them. |
Well, that’s problematic. I’m not sure I can be of further help. Without the exact error, I am not sure what can be done Sent with GitHawk |
Ok no worries. I will just live on 3.0.0 until it dies. |
There should be additional info when you start your server locally with 3.1.0 For example:
don't you have those?
I'm not sure why I spent a good amount of my sunday evening trying to help you then. |
I definitely appreciate the help you gave me I just don't know what else to do and since I cannot give you the logs you requested there isn't much else that can be done. |
But for one, what is the error that goes after Sent with GitHawk |
Just wanted to let you know @flovilmart . I ended up exporting the relevant tables with data into a new clean db and all is working great now. I updated all the way to the current 3.1.3. Thanks again for all your help. |
@flovilmart I believe I had a similar problem to @jc73300. I tested all parse-server versions greater than 3.0.0 and consistently ran into this problem. I do not experience this problem with 3.0.0. I am using Postgres, for what it's worth. 2019-02-09T18:33:48.106800+00:00 app[web.1]: TypeError: Cannot redefine property: _Installation |
Can you share your schema please? Sent with GitHawk |
It’s not what I meant, I meant the contents of the _SCHEMA table Sent with GitHawk |
create table "_SCHEMA" INSERT INTO public."_SCHEMA" ("className", schema) VALUES ('_Installation', '{"fields": {"id": {"type": "String"}, "user": {"type": "Pointer", "targetClass": "_User"}, "badge": {"type": "Number"}, "_rperm": {"type": "Array", "contents": {"type": "String"}}, "_wperm": {"type": "Array", "contents": {"type": "String"}}, "appName": {"type": "String"}, "channels": {"type": "Array"}, "objectId": {"type": "String"}, "pushType": {"type": "String"}, "timeZone": {"type": "String"}, "createdAt": {"type": "Date"}, "updatedAt": {"type": "Date"}, "appVersion": {"type": "String"}, "deviceType": {"type": "String"}, "GCMSenderId": {"type": "String"}, "deviceToken": {"type": "String"}, "parseVersion": {"type": "String"}, "appIdentifier": {"type": "String"}, "installationId": {"type": "String"}, "localeIdentifier": {"type": "String"}}, "className": "_Installation"}'); |
Ok. I believe I know what’s going on, but I am not sure how the _Installation schema is appearing twice. Would you be able to insert a console.log to print the contents of the Sent with GitHawk |
@johanarnor Does dropping the index delete the contents in that column? I need the usernames & emails of _User |
I was able to dropIndexes for _Role name and _User username but dropping _User email doesn't resolve the last warning I have |
@acegreen For me, 3 warnings of these nature were gone. warn: Unable to ensure uniqueness for usernames: MongoError: Index with name: username_1 already exists with different options |
exactly those, the last one was the email which i dropped as well but the warning won't go away. For some reason my warning is truncated so I don't actually see the index name |
@acegreen I have the same issue, did you solve it? |
I have had the same issue. |
@acegreen I did dropIndex on those ones that threw errors from the log. Then re-deployed Parse-server the warnings were gone. I am with MongoDB 4.0.0 on MongoDB Atlas and Parse-server 3.9.0. |
run into the same issues: Resolve this with Mongo Shell
|
error: Uncaught internal server error. TypeError: Cannot redefine property: _PushStatus
at Function.defineProperty ()
at SchemaData.volatileClasses.forEach.className (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:530:14)
at Array.forEach ()
at new SchemaData (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:529:21)
at getAllClasses.then.allSchemas (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:654:27)
at process.internalTickCallback (internal/process/next_tick.js:77:7) TypeError: Cannot redefine property: _PushStatus
at Function.defineProperty ()
at SchemaData.volatileClasses.forEach.className (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:530:14)
at Array.forEach ()
at new SchemaData (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:529:21)
at getAllClasses.then.allSchemas (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:654:27)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
TypeError: Cannot redefine property: _PushStatus
at Function.defineProperty ()
at SchemaData.volatileClasses.forEach.className (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:530:14)
at Array.forEach ()
at new SchemaData (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:529:21)
at getAllClasses.then.allSchemas (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:654:27)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
The text was updated successfully, but these errors were encountered: