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

com.parse.ParseRequest$ParseRequestException: Could not store file. #670

Closed
sandeep2242 opened this issue May 20, 2017 · 25 comments
Closed

Comments

@sandeep2242
Copy link

sandeep2242 commented May 20, 2017

I am working on Parse using Heroku server. last night my Images was uploading fine (all other data is uploading fine ie string ,int etc), but this morning there was an error in uploading images and the error was ie
com.parse.ParseRequest$ParseRequestException: Could not store file.
` final ParseObject productDetails = new ParseObject("VendorInv");

        productDetails.put("productMrp", mrp2);
        productDetails.put("productName", name2);
        productDetails.put("productDetails", details2);
       // productDetails.put("size", size2);
        productDetails.put("type", type2);
        productDetails.put("color", color2);

        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        // Compress image to lower quality scale 1 - 100
        cropped.compress(PNG, 100, stream);
        byte[] image = stream.toByteArray();

        // Create the ParseFile
        final ParseFile file = new ParseFile(name2 + ".png", image,"image/png");
        file.saveInBackground(new ProgressCallback() {
            @Override
            public void done(Integer percentDone) {
                Log.i("Parse", percentDone.toString());
            }
        });
        file.saveInBackground(new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    productDetails.put("productImage", file);

                    try {
                        productDetails.save();

                        String obj = productDetails.getObjectId();

                        ParseObject pd = ParseObject.createWithoutData("Vendors", objId);

                        ParseRelation<ParseObject> pr = pd.getRelation("vendorInv");

                        pr.add(ParseObject.createWithoutData("VendorInv", obj));

                        pd.saveInBackground(new SaveCallback() {
                            @Override
                            public void done(ParseException e) {
                                if (e == null) {
                                    Log.i("Parse", "Save Succeeded");
                                } else {
                                    Log.i("Parse", e.toString());
                                }
                            }
                        });
                    } catch (ParseException e1) {
                        e1.printStackTrace();
                    }
                } else {
                    Log.i("sand", e.toString());
                }
            }
        });`  

EDIT

`final ParseObject productDetails = new ParseObject("VendorInv");
            if (EorF) {                   // Electronics
                productDetails.put("productMrp", mrp2);
                productDetails.put("productName", name2);
                productDetails.put("productDetails", details2);
                productDetails.put("type", item2);
                productDetails.put("model", pModel2);
                productDetails.put("color", colorId);


            } else {                           // fashion
                productDetails.put("productMrp", mrp2);
                productDetails.put("productName", name2);
                productDetails.put("productDetails", details2);
                productDetails.put("size", item1);
                productDetails.put("type", item2);
                productDetails.put("color", colorId);
            }

            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            if (cropped != null) {
                cropped.compress(PNG, 100, outputStream);
                byte[] imgs = outputStream.toByteArray();

                ParseFile file = new ParseFile("sandeep.png", imgs);
                file.saveInBackground(new SaveCallback() {                            //error
                    @Override
                    public void done(ParseException e) {
                        if (e == null) {
                            Log.i("Parse", "Save Succeeded");
                        } else {
                            Log.i("Parse", "not Succeeded");
                        }
                    }
                });
            } else {
                Log.i("Parse", "is null");
            }

            try {
                productDetails.save();

                obj = productDetails.getObjectId();

                ParseObject pd = ParseObject.createWithoutData("Vendors", objId);

                ParseRelation<ParseObject> pr = pd.getRelation("vendorInv");

                pr.add(ParseObject.createWithoutData("VendorInv", obj));

                pd.saveInBackground(new SaveCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e == null) {
                            Log.i("Parse", "Save Succeeded");
                        } else {
                            Log.i("Parse", e.toString());
                        }
                    }
                });
            } catch (ParseException e1) {
                Log.i("Parse23", e1.toString());
            }`
@natario1
Copy link
Contributor

Looks like an error within your files controller in parse-server... Why are you saving the file twice? To define both callbacks you should use file.saveInBackground(progressCallback, saveCallback).

@sandeep2242
Copy link
Author

It was just to check wether r it saves or not. So what should i do to solve this problem?

@sandeep2242
Copy link
Author

@natario1 I'm stucked here for couple of days , please any help would be greatly appereciated.

@natario1
Copy link
Contributor

I think this is a server issue, we send the data and get the response. Files controller is not able to save, link.

Might be related parse-community/parse-server#3830

Do you get any info in parse-server logs?

Remove one of the saveInBackground, and try to reduce the file size (crop the image, compress with lower quality, ...). If it works maybe you have to increase the maxUploadSize in parse server.

@sandeep2242
Copy link
Author

sandeep2242 commented May 20, 2017

@natario1 I have removed saveInBackground but still it's not working, and i think size is not a
problem , bcoz yesterday only i have uploaded same images in parse.

@natario1
Copy link
Contributor

Do you get any logs in parse-server when the upload fails?

@sandeep2242
Copy link
Author

sandeep2242 commented May 20, 2017

@natario1 2017-05-20T16:23:36.461590+00:00 heroku[router]: at=info method=POST path="/parse/files/cuucufu.png" host=mainandroid.herokuapp.com request_id=596145c5-dd52-4033-bd1c-a8dd1a2bff8e fwd="103.249.239.170" dyno=web.1 connect=0ms service=29841ms status=400 bytes=520 protocol=https

@sandeep2242
Copy link
Author

@natario1 any idea whats going on?

@natario1
Copy link
Contributor

Nope. Let’s wait to see if someone else can help you, but I think you’ll get better help on parse-server. Looks like a configuration issue.

By the way, in the original comment you had pasted more lines of logs, now you left just one, but some of these were meaningful (the ones with at=warning). I’d suggest to edit the comment again to include them.

@sandeep2242
Copy link
Author

@natario1 Thanks for looking into my problem. I am unable find any logs regarding warning, and in addition to that I can upload String ,Integers and array but not Images.

@cjosepha
Copy link
Contributor

cjosepha commented May 26, 2017

@sandeep2242 does this happen for any file size or only when file size exceed a certain limit? Do you have a very simple ParseFile code saving example that produce the issue?

@sandeep2242
Copy link
Author

@dangtz the only thing I am saving is an image , which i have converted into a file

@cjosepha
Copy link
Contributor

@sandeep2242 I've updated my comment, my question is about file size, not file type.

@Jawnnypoo
Copy link
Member

Instead of Log.i("Parse", e.toString()); do e.printStackTrace(); and look through the Android Monitor and see if you can see what the exact exception is.

@sandeep2242
Copy link
Author

@dangtz file size is 200kb

@sandeep2242
Copy link
Author

@Jawnnypoo when i checked my parse logs it shows , Quota exceeded ,Could not store file

@Jawnnypoo
Copy link
Member

So I suppose that is your issue then. You will have to get more storage space from your provider.

@sandeep2242
Copy link
Author

untitled

@Jawnnypoo please can u check my db stats and please tell me wether i have to change my sandbox plans

@Jawnnypoo
Copy link
Member

No I cannot. I have no access to things like that. You need to speak with whoever set up your Parse server instance, more than likely you have exceeded your limits on mLab or whatever provider you are using for MongoDB. This is the tracker just for the Android SDK, if you need help with server stuff, go ahead and open an issue on the server issue tracker.

@sandeep2242
Copy link
Author

@Jawnnypoo I have opened But no one is bothering to reply. Btw Thank you.

@flovilmart
Copy link
Contributor

@sandeep2242 not sure what you're talking about... parse-community/parse-server#3839 But yes, if you think we don't take the time to respond to you, that's fine.

@sandeep2242
Copy link
Author

@flovilmart I have created my database 3 times and every time parse logs shows Could not store file,quota exceeded.

@flovilmart
Copy link
Contributor

Did you ever mentioned that? No I don't think so. Also, the error you have is a mongoDB error, not a parse-server error. Perhaps you should investigate it. And as mentioned many time, you should store your files on S3 or something similar, not in DB!

@sandeep2242
Copy link
Author

@flovilmart I'll investigate more into it. Thank You

@jadhavmanoj
Copy link

@flovilmart @sandeep2242 do you guys find any solution to this problem. I am facing the same issue.

any help appreciated.

Thanks

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

6 participants