New Issue Checklist
Issue Description
Note: This issue has already been tested with the following:
- Configuring ParseServer options
maxUploadSize
- Defining directives for an NGINX proxy
For applications handling large media data, performing either chunked uploads or directly writing to an independent 3rd party storage provider via the client is advised. For the latter, assuming one's correctly retrieved the remote url of the uploaded media file, documentation implies it's possible to construct a new Parse.File object with the following:
new Parse.File(`fileName`, {uri: "https://urlToLargeMediaFile"})
which can then be set on a Parse.Object. However, Parse.File seems to automatically attempt to encode the data and terminates ParseServer with RangeError: Invalid string length.
Steps to reproduce
- Upload large video file to some external storage provider
- Construct
new Parse.File(fileName, {uri: remoteURLToLargeMediaFile})
- Attempt to save
Parse.File and set to Parse.Object
Actual Outcome
ParseServer terminates with the following error:
RangeError: Invalid string length
at IncomingMessage.<anonymous> (/Users/John/Project/test/node_modules/parse-server/node_modules/parse/lib/node/ParseFile.js:468:45)
at IncomingMessage.emit (node:events:513:28)
at IncomingMessage.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:293:11)
at Readable.push (node:internal/streams/readable:234:10)
at HTTPParser.parserOnBody (node:_http_common:131:24)
at TLSSocket.socketOnData (node:_http_client:542:22)
at TLSSocket.emit (node:events:513:28)
at TLSSocket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
Expected Outcome
Ideally, we should extend Parse.File to simply be initialized without attempting to encode/decode the data specified by the uri. For now, I've managed to define the file property of a Parse.Object with the following:
object.set(`file`, {
"__type": "File",
"name": "demo.mp4",
"url": "https://urlToRemoteMediaFile/tag.mp4"
})
Not sure if there's some further configuration one can do within the files adapter, but either way, I thought this was an issue to raise when handling memory allocation with large media data...
Server
- Parse Server version:
7.0.0
- Operating system:
MacOS
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
LocalHost/Google Cloud
Database
- System (MongoDB or Postgres):
Postgres
- Database version:
16.3
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Postgres
Client
- Parse JS SDK version:
5.1.0
New Issue Checklist
Issue Description
For applications handling large media data, performing either chunked uploads or directly writing to an independent 3rd party storage provider via the client is advised. For the latter, assuming one's correctly retrieved the remote url of the uploaded media file, documentation implies it's possible to construct a new
Parse.Fileobject with the following:which can then be set on a
Parse.Object. However,Parse.Fileseems to automatically attempt to encode the data and terminates ParseServer withRangeError: Invalid string length.Steps to reproduce
new Parse.File(fileName, {uri:remoteURLToLargeMediaFile})Parse.Fileand set toParse.ObjectActual Outcome
ParseServer terminates with the following error:
Expected Outcome
Ideally, we should extend
Parse.Fileto simply be initialized without attempting to encode/decode the data specified by the uri. For now, I've managed to define the file property of aParse.Objectwith the following:Not sure if there's some further configuration one can do within the files adapter, but either way, I thought this was an issue to raise when handling memory allocation with large media data...
Server
7.0.0MacOSLocalHost/Google CloudDatabase
Postgres16.3PostgresClient
5.1.0