Backendless Support
 
In Progress

Maximum POST data size and NullPointerException

Hi all,

I tested a method to upload a big blob of data (15492940 Byte zip file; as base64: 20657256 characters), in the json data of a POST request. This looks like the following:

{

"id": 103,

"data": "<LONG BASE64-STRING>",

"mimetype": "application/zip"

}

But I get the following error response: "400 - Service invocation failed: ExceptionClass:"NullPointerException" {Msg:"none", Cause:"none"} (14004)". Is that an internal error in backendless? Or is it an error in my codeless method?

Background of my test with this big chunk of data in a POST request and why I'm not using the file API: I have multiple users which are only allowed to write data if there is an entry with meta data for the binary file and if the file belongs to the specific user. So I wanted to do the file writing with a codeless method, to report an error if these (and more) conditions are not fulfilled and the data wont be written. If I would use the file API, I dont have the control over the data the user writes.

Do you have any solution for this problem in mind? How I could solve this.

Best regards, Jonas

Leave a Comment

Comments (8)

photo
1

hello, please provide your application id

photo
1

The application ID is: 63087FF7-7E1D-973D-FF3B-D5F0740FA100

I got the idea to solve the problem with an event handler before the file is saved. There I could check whether all needed information and all neccecary rights for the user are fulfilled. If not I would return an exception.

Which solution, save data with codeless method or event handler, would you recommend for this API?

photo
1

I would suggest to use beforeUpload event handler, there is context where you can find user id, also you will have file path

photo
1

While playing with the beforeUpload event handler, I noticed that the "Request file path" variable/object is empty. When I take the "FileURL" property of the "Request" object then I get the complete URL, but not only the path from the folder/file.

Is this intended that the "Requerst file path" is empty?

And is there any possibility to have a beforeRead event handler, to check whether the user is allowed to read a specific file?

photo
1

>>Is this intended that the "Requerst file path" is empty?

no, it is not, I will create a ticket to fix this problem.

>>And is there any possibility to have a beforeRead event handler, to check whether the user is allowed to read a specific file?

also ticket will be created

upd: ticket ID is BKNDLSS-15806

photo
1

Thank you very much Sergey. Could you let me know when you fixed it?

photo
1

Sure, we will notify you as soon as we release this fix.

photo
1

Jonas,

Ticket regarding file path has been fixed and released. BeforeRead handler - not ready yet.

Best Regards