-
-
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
Cannot create '_GlobalConfig' entry of type 'File' #3457
Comments
I think I have narrowed down the issue to the code in MongoTransform.js (Specifically FileCoder.JSONToDatabase): When transforming a 'File' to be written to the database, it just writes the 'name' field of the file instead of the remaining information. I assume this works in other places within parse server (for example when a class has a field of type 'File') because the schema dictates that the field is a 'File' but on the '_GlobalConfig' object, if the name is just stored as a string then the config will be treated as a 'String' not a 'File' |
Uhm... we obviously treat _GlobalConfig as any other ParseObject which is bad as it isn't backed by a shema. We should probably not transform any of the values there. |
Yeah I'm happy to take a stab at fixing it. I figured there was a reason that 'Files' were being transformed in this way for other cases (for example when a 'File' is a field on a parse object) so I couldn't just alter this code. It looks like we have access here to the className so I could add some special logic for className="_GlobalConfig" and type = 'File', does that sound reasonable? |
Let's see how it looks like, or if we can extract in a more general way. Not a big fan of 'class specific' code in the transformation funcs, but something else may be problematic as well. |
Sent out a PR here: Let me know what you think when you have a chance |
Closed via #3531 |
When trying to create a new entry in Config of type 'File', parse server does not properly store the value in config
Steps to reproduce
Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.
{
"params": {
"test": {
"__type": "File",
"name": "98a385dbd42e07c932d4d012291295cc_default_tango_sku_2.json",
"url": "https://parse-server-dev.herokuapp.com/parse/files/{App ID}/98a385dbd42e07c932d4d012291295cc_default_tango_sku_2.json"
}
},
"_method": "PUT",
"_ApplicationId": "{Application Id}",
"_ClientVersion": "js1.6.14",
"_MasterKey": "{Master Key}",
"_InstallationId": "{Installation Id}"
}
(this body was modeled after what is generated from the parse dashboard when trying to create a new config value of type 'File')
Expected Results
Expected result if to have a new config value named 'test' that is of type: 'File'.
Actual Outcome
Actual outcome is that a new config value called 'test' is created and is of type 'String'
Environment Setup
Server
Database
The text was updated successfully, but these errors were encountered: