Skip to content
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

File object on Config page goes type "String" instead of "File" #637

Closed
MasaGon opened this issue Jan 24, 2017 · 9 comments
Closed

File object on Config page goes type "String" instead of "File" #637

MasaGon opened this issue Jan 24, 2017 · 9 comments

Comments

@MasaGon
Copy link

MasaGon commented Jan 24, 2017

Environment Setup

Parse Dashboard 1.0.22 on Windows 10, Node.js v6.9.2
Parse Server v2.3.2 on Amazon Linux, EC2, wrapped with Elastic Beanstalk

Steps to reproduce

  1. Go config page on Parse Dashboard
  2. Click "Create a parameter"
  3. Parameter Name: "test", Type: "File" then "Upload a file" and click "Create parameter"
  4. Reload page and you should see type of "test" parameter go "String" instead of "File"
  • [ x] You're running version >=1.0.21 of Parse Dashboard.
  • [ x] You're running version >=2.2.24 of Parse Server.
  • [ x] You've searched through existing issues. Chances are that your issue has been reported or resolved before.
@mross22
Copy link

mross22 commented Jan 31, 2017

I saw this issue as well. After doing some investigating, I think this is an issue in parse-server itself and not parse-dashboard.

In parse server, when transforming a 'File' object to be stored in the database it looks like it is converted to only the value of the 'name' field which appears to be the root cause of the issue you are reporting. (see FileCoder.jsonToDatabase):
https://github.com/ParsePlatform/parse-server/blob/4cb6e7d209903990c02e2e3f1a9bcd4aa03983aa/src/Adapters/Storage/Mongo/MongoTransform.js

If you look in your underlying mongoDB, you can see that when you create a config value of type 'File' in the dashboard, it correctly creates the file, it is just referenced improperly in the '_GlobalConfig' collection.

For example, if you create a 'File config value named 'test', your '_GlobalConfig' in mongo will have a field something like:
"test": "41c9ddbf510d26cabad1cec6f2244dc1_test.json"

If you manually update this in the database to be of the form:

"test" : {
_type: "__File",
name:"41c9ddbf510d26cabad1cec6f2244dc1_test.json",
url: "{parse server url}/parse/files/{appid}/{file name from above}"
}

and then refresh parse dashboard in the browser, you will now see that everything works properly.

In summary, it looks like parse-server is failing to record the config value as type 'File' with a 'name' and 'url' field so even though the File itself is stored, the dashboard doesn't know where to find it.

I will file an issue on Parse-Server

@mross22
Copy link

mross22 commented Jan 31, 2017

Here is the tracking parse-server issue:
parse-community/parse-server#3457

@flovilmart
Copy link
Contributor

Closing as tracked on parse-server

@flovilmart
Copy link
Contributor

Thanks @mross22 do you want to take on the fix?

@mross22
Copy link

mross22 commented Jan 31, 2017

sure, I'll follow up on the other thread and send out a PR

@natanrolnik natanrolnik reopened this Feb 19, 2017
@natanrolnik
Copy link
Contributor

@mross22 @flovilmart this was actually a bug by itself, not related to parse-community/parse-server#3457.
Now that the creation of a File and setting it to config works, the Dashboard still displays it as a stringified version of the File object.

I've fixed it and opened a PR #666

@natanrolnik
Copy link
Contributor

Fixed in the latest release

@Abderezai
Copy link

broken again

@flovilmart
Copy link
Contributor

@Abderezai that's not what I would say a proper issue report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants