Skip to content

Cloud code doesn't automatically parse File objects #2294

@smassin

Description

@smassin

Issue Description

When uploading a ParseFile as a parameter to cloud code it does not automatically parse the object and transform it into the ParseFile on the cloud code side. On parse.com it would do this automatically. Essentially I could save a file on the client and then pass the ParseFile as a parameter in a cloud call and then on the cloud side it would show up as a ParseFile. Documented here: https://parse.com/docs/rest/guide#objects-data-types . Instead the cloud side just sees a normal JSON object that would represent a ParseFile. Even using the Parse Client JS SDK has the same problem.

To further muck up the situation, parse-server allows these JSON objects to be saved in File columns but when they are retrieved they are still a basic JSON object and calling .url() causes the server to spin forever and never complete the request.

  1. Was this functionality intentionally removed?
  2. While its fine that it doesn't automatically convert to a ParseFile, the Parse SDK doesn't provide a way to create a Parse.File manually from such a JSON structure. Any thoughts?

Steps to reproduce

  1. Run code such as:
var parseFile = new Parse.File("theFile", document.getElementById("theFile").files[0]);
parseFile.save().then(function(file){
   Parse.Cloud.run("cloudFunction", {file:file})
})

Expected Results

Parse.Cloud.define("cloudFunction", function(request, response) {
 response.success(request.params.file instanceof Parse.File);
})

request.params.file instanceof Parse.File === true;

Actual Outcome

request.params.file instanceof Parse.File === false;

Environment Setup

  • Server
    • parse-server version: 2.2.14
    • Localhost or remote server? Azure
  • Database
    N/A -- Completely parse-server software issue

Logs/Trace

Outcomes above should be detailed enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions