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

Error when parsing large amounts of JSON #6277

Open
louisescher opened this issue May 9, 2024 · 0 comments
Open

Error when parsing large amounts of JSON #6277

louisescher opened this issue May 9, 2024 · 0 comments
Labels
[possible-bug] Possible bug which hasn't been reproduced yet

Comments

@louisescher
Copy link

louisescher commented May 9, 2024

Link to reproduction

https://github.com/louisescher/minimal-payload-repro

Describe the Bug

I created a custom upload field which uses the local API to upload multiple files at once. When uploading files larger than 1MB, payload throws this error:
SyntaxError: Unterminated string in JSON at position 1048576

This error originates from here:

const payloadJSON = JSON.parse(req.body._payload)

Changing the Express JSON limit doesn't work, I've tried setting it to way over 1GB, yet the same error is thrown. The same error does not appear when uploading directly to the media collection.

To Reproduce

  1. Clone the repo from the link to the reproduction
  2. Run docker compose up
  3. Create a new account in the local payload instance
  4. Head to http://localhost:3000/admin/globals/bulk-upload
  5. Try to upload any image (or any file) larger than 1MB (Errors out)
  6. Head to http://localhost:3000/admin/collections/media
  7. Upload the same image (or file), the error will not occur

Payload Version

2.16.1

Adapters and Plugins

db-mongodb, bundler-webpack, richtext-slate

@louisescher louisescher added the [possible-bug] Possible bug which hasn't been reproduced yet label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[possible-bug] Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant