parse-server: Unable save large file to S3 using Parse server

I tried to save to S3 bucket using Parse, and it can be saved correctly when the file is small, such as 864.2KB. However, when the file is large, say 5MB, it complaints with a message saying: “The data couldn’t be read because it isn’t in the correct format”

I’m using the following code to save the the video file to the S3

 func saveVideo(withVideoURL url: URL){
        let post = PFObject(className: "Post")
        post["caption"] = "Out of the game for 6 months, but back with vengeance. Meet your 2017 AO Men's champion"
        do{
            let data = try Data(contentsOf: url)
            print(data)
            post["media"] = PFFile(data: data)
            post.saveInBackground { (success, error) in
                if success{
                    print("video saved")
                }else{
                    print("failed")
                    if error != nil{
                        print(error!.localizedDescription)
                    }else{
                        print("erorr is nil")
                    }
                }
            }
        }catch let error as NSError{
            print("can't read")
            print(error.localizedDescription)
        }
    }

Besides, even when the small video file is indeed being saved to the S3, it contains an extension .bin instead of, for example .mp4. I wonder what’s happening here The url end up looking something like this

https://s3-us-west-1.amazonaws.com/sampleApp/19d5bce20f8b55te1b1b8f370212533e5_file.bin

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@omarojo I’m not familiar with Heroku — I used AWS. At the time, I think what I did was update the Nginx/.ebextension file specifying the maximum upload video size