-
-
Notifications
You must be signed in to change notification settings - Fork 596
Uploading large file as base64 string to parse server throws an error #1516
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
Comments
Thanks for opening this issue!
|
This seems to be an unusual approach to handle a file of that size. Storing 17 MB of string in a variable in memory is not the most robust concept. You may be hitting a memory limit with regex there. More investigation on your side would be needed to identify the root cause; find out where the error occurs - in the Parse client SDK or in Parse Server and at which line of code. General note; please do not post the same question multiple times; you (and someone else with a different account) has been posting this issue in multiple places over the last 24 hours. |
Just stumbled over a similar issue in the JS SDK. Maybe this approach has now been added to other Parse SDK's as well. We suddenly got this error in one of our automated tests after years of not having any issue:
As a fix, we modified some older code to pass a byte array instead (which makes more sense). It took however some time to figure out what was happening here. Turns out Parse JS-SDK 3.3.4 over 3.3.0 has a (breaking?) change that is not immediately obvious until looking at the Parse.File source code. In 3.3.4, this code is executed in Parse.File() to verify the base64 encoded file data:
And here the regex:
With a ~2MB base64 string (jpeg image) it took around 6 minutes (!!!) with 100% cpu (=full single core) until the regex failed. The base64 was however correct as any image saved with Parse JS-SDK 3.3.0 and earlier could be downloaded/viewed without error. IF there is a need to test for valid base64 data in Parse.File, a simple base64 decode would probably be more efficient (at the expense of using more memory). But I would question that there is a need to test at all. Worse case the base64 data is invalid and either:
The 1st two can be caught by the client-app while uploading. Just wanted to quickly comment on this so others might save some time troubleshooting. Problem is solved on my end and won't be using base64 upload anymore. |
See #1532 |
New Issue Checklist
Issue Description
Uploading an recorded video of 17mb from ionic android to parse server throws an error.
Steps to reproduce
-- Which throws an error at RegExp.test().
Looking for help.
Actual Outcome
Expecting to upload video same as image
Expected Outcome
Expecting to upload video same as image
Environment
version --- "^3.4.3",
Server
Windows
Local
Database
Mongo DB
1.31.3
Local
Client
Ionic Angular
android
The text was updated successfully, but these errors were encountered: