parse-server: ParseFile save fails on parser-server after migration: Unable to encode an unsaved ParseFile

I am using parse-android SDK 1.13.0. I am able to upload file to parse’s backend.

But when i change my server endpoint to migrated end point, upload fails.

{
    "code": 130,
    "error": "Invalid file upload."
}

I added console logs in file.js on parse-server i found the request.body is empty.

Files.js processCreate req: [object Object] : {} : undefined

var processCreate = function(req, res, next) {
console.log(" Files.js processCreate req:"+req+" : "+ JSON.stringify(req.body)+" : "+req.body.length
if (!req.body || !req.body.length) {
    next(new Parse.Error(Parse.Error.FILE_SAVE_ERROR,
         'Invalid file upload.'));
    return;
  }

Exception message shown on client side.

iIllegalStateException: Unable to encode an unsaved ParseFile

Seems to be an issue on the parse-server side. The request body is found empty. I reported this issue on parse-android-sdk. Since the sdk could upload to parse hosted backend. Suspect is on the parse-server side.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 48 (6 by maintainers)

Most upvoted comments

Just got this error message from iOS SDK

[Error]: Could not store file. (Code: 130, Version: 1.12.0)

Not sure if it’s related to this same problem cause it was working and it stopped since I updated to version 2.1.3. I’m using the S3 adapter. Any ideas?

Getting this error out of no where now. Was working fine yesterday.

Error Domain=Parse Code=130 “Could not store file.” UserInfo={code=130, temporary=0, error=Could not store file., NSLocalizedDescription=Could not store file.}

problem solved 👍 i had a problem in the s3 adapter

I was able to resolve the issue by adding a file content Type like this. pFile = new ParseFile(data, “image/jpeg”);

I would suggest that it should be updated on the documentations if contentType is a required field or ParseFile

@NatanRolnik Sure. I am fairly new to parse community but will contribute what I can. Thanks for the links.

Solved the issue by declaring parse file as ParseFile file = new ParseFile(data,“resume.txt”);

lesson learned: Don’t rely solely on documentation 😃