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

feat: Allow large Parse File uploads #9286

Open
wants to merge 26 commits into
base: alpha
Choose a base branch
from

Conversation

dalyaidan1
Copy link

Pull Request

Issue

Closes: #9283

Approach

During routing if a file size is larger than can be handled by the V8 engine as a string, it is used as a Blob. This changes touches both the FilesRouter and GridFSBucketAdapter where the creation/upload happens, and the file is handled as a Buffer. I also added a new FilesRouter test spec for these changes.

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Copy link

Thanks for opening this pull request!


afterAll(async () => {
// clean up the server for resuse
if (server && server.close) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be enough to just call await reconfigureServer() to init the server with the default config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your right. Missed that, new to testing here.

src/Adapters/Files/FilesAdapter.js Outdated Show resolved Hide resolved
Signed-off-by: Manuel <[email protected]>
Copy link

codecov bot commented Aug 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.52%. Comparing base (30a836d) to head (a87a452).

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #9286      +/-   ##
==========================================
+ Coverage   93.50%   93.52%   +0.02%     
==========================================
  Files         186      186              
  Lines       14810    14834      +24     
==========================================
+ Hits        13848    13874      +26     
+ Misses        962      960       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mtrezza
Copy link
Member

mtrezza commented Aug 18, 2024

There seems to be some test coverage missing, could you add that?

src/Adapters/Files/GridFSBucketAdapter.js Outdated Show resolved Hide resolved
src/Adapters/Files/GridFSBucketAdapter.js Outdated Show resolved Hide resolved
@mtrezza mtrezza requested a review from a team September 4, 2024 15:47
src/Routers/FilesRouter.js Outdated Show resolved Hide resolved
src/Routers/FilesRouter.js Outdated Show resolved Hide resolved
@mtrezza
Copy link
Member

mtrezza commented Oct 8, 2024

Could you take a look at the failing postgres tests?

a storage adapter is needed to test postgres
@dalyaidan1
Copy link
Author

dalyaidan1 commented Nov 2, 2024

Could you take a look at the failing postgres tests?

@mtrezza I changed those failing tests to only mongo. Without pulling in a storage adapter such as the fs adapter, those tests will not be able to pass in postgres. Let me know if pulling in one as a dev dependency would be preferable?

All the adapters will also need changes similar to the inbuilt GridFS adapters changes in order to handle the large files. I have adjustments for the fs and s3 adapters that I can also make PRs in their respective repositories for as needed.

@mtrezza
Copy link
Member

mtrezza commented Nov 3, 2024

I understand the change is really for the GridFSStorageAdapter and it just so happens that the adapter is bundled with Parse Server. It isn't related to DB adapters, so maybe the tests should be MongoDB only in this PR. Does that make sense? Only if the Postgres adapter supported Parse.File upload (like MongoDB does with GridFS), then there would be some Postgres related changes needed in this PR, does it?

Yes, for other storage adapters the PRs in their respective repos would be great.

@dalyaidan1
Copy link
Author

Yes that is correct. There would need to be inbuilt storage adapters to test for postgres.

I've made the other PRs:

@mtrezza
Copy link
Member

mtrezza commented Nov 3, 2024

Could you change the test from it to it_only_db('mongo') I believe it's called.

@dalyaidan1
Copy link
Author

Could you change the test from it to it_only_db('mongo') I believe it's called.

I think I covered this in 18157be already?

The one current fail appears to be one of the flaky tests mentioned in here

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

Successfully merging this pull request may close these issues.

Parse.Files cannot be created if over 512MB
2 participants