Skip to content

File upload fails with "Cannot read property 'enableForAnonymousUser' of undefined" #7085

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

Closed
4 tasks done
gnunicorn opened this issue Dec 19, 2020 · 3 comments · Fixed by #7086
Closed
4 tasks done
Labels
state:released Released as stable version state:released-beta Released as beta version type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@gnunicorn
Copy link

New Issue Checklist

Issue Description

Trying to upload a file (as a logged in user), the request endlessly stales and the server errors with:

parse_1      | (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'enableForAnonymousUser' of undefined
parse_1      |     at createHandler (/parse-server/lib/Routers/FilesRouter.js:113:41)
parse_1      |     at Layer.handle [as handle_request] (/parse-server/node_modules/express/lib/router/layer.js:95:5)
parse_1      |     at next (/parse-server/node_modules/express/lib/router/route.js:137:13)
parse_1      |     at /parse-server/lib/middlewares.js:252:7
parse_1      |     at runMicrotasks (<anonymous>)
parse_1      |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
parse_1      | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

Steps to reproduce

Get the docker-image (no custom configuration) try to upload a file as a regular user. The promise never finishes.

Actual Outcome

The server error's and the network never responds.

Expected Outcome

The server should accept the upload, store the file and respond

Failing Test Case / Pull Request

Looks like it was introduced in #7071.

Environment

Using current latest docker image: https://hub.docker.com/layers/parseplatform/parse-server/latest/images/sha256-1b8dfd378cc731e9b81f6398e0eadbaef368f60ad9d731d09b299df0d375ffda?context=explore

Database

  • System (MongoDB or Postgres): Postgres
  • Database version: FILL_THIS_OUT
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): FILL_THIS_OUT

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Javascript
  • SDK version: 2.19.0

Logs

@mtrezza
Copy link
Member

mtrezza commented Dec 19, 2020

Thanks for reporting.

I was able to reproduce the issue, a PR is on the way.

The issue is that default values for fileUpload options are not applied.
Current workaround is to explicitly set the fileUpload options.

@mtrezza mtrezza added type:bug Impaired feature or lacking behavior that is likely assumed S3 and removed needs more info labels Dec 19, 2020
@mtrezza mtrezza changed the title File upload doesn't work since #7071: Cannot read property 'enableForAnonymousUser' of undefined File upload fails with "Cannot read property 'enableForAnonymousUser' of undefined" Dec 19, 2020
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Nov 1, 2021
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-beta Released as beta version type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants