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

[BUG] Payload too large #21

Closed
jonadeline opened this issue Jul 18, 2022 · 8 comments
Closed

[BUG] Payload too large #21

jonadeline opened this issue Jul 18, 2022 · 8 comments
Assignees

Comments

@jonadeline
Copy link

Hi there,
First, thanks for this promising plugin :)

I'm experimenting an issue when i try to import a JSON or CSV, the browser is raising a 413 HTTP error (payload too large).
Is there a way to increase the limit ?

@Baboo7
Copy link
Owner

Baboo7 commented Jul 18, 2022

What is the size of the file?

@jonadeline
Copy link
Author

1.5mb

@Baboo7
Copy link
Owner

Baboo7 commented Jul 19, 2022

The limitation comes from the middleware body from Strapi. Here is how to raise the limit:

// ./config/middlewares.js

module.exports = {
  // ...
  {
    name: 'strapi::body',
    config: {
      jsonLimit: '10mb',
    },
  },
  // ...
}

See the middleware doc

@Baboo7
Copy link
Owner

Baboo7 commented Jul 19, 2022

I updated the config section of the doc

@jonadeline
Copy link
Author

Merci :)

@Baboo7 Baboo7 closed this as completed Jul 19, 2022
@molul
Copy link

molul commented Dec 9, 2023

Hi. I just had the same error message, and I've opened my config/middlewares.js file, but I see an array of strings, not a json object. This is the content:

module.exports = [
  'strapi::errors',
  'strapi::security',
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::logger',
  'strapi::query',
  'strapi::body',
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
];

How should I add the code @Baboo7 mentions above?

module.exports = {
  // ...
  {
    name: 'strapi::body',
    config: {
      jsonLimit: '10mb',
    },
  },
  // ...
}

@Baboo7
Copy link
Owner

Baboo7 commented Dec 9, 2023

@molul you have to replace the string with the object, like this:

module.exports = [
  'strapi::errors',
  'strapi::security',
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::logger',
  'strapi::query',
  {
    name: 'strapi::body',
    config: {
      jsonLimit: '10mb',
    },
  },
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
];

@molul
Copy link

molul commented Dec 9, 2023

Worked like a charm. Thanks!

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

No branches or pull requests

3 participants