-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Bug]: Image size limit extremely low Admin Ui uploads #12117
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
Comments
I saw in medusa docs that i should add a middleware to increase the default 100kb size import { defineMiddlewares } from "@medusajs/framework/http" // Define the upload variable before using it export default defineMiddlewares({ This is what i have but doesnt work either |
I've been investigating this image upload issue and have some insights that may help. After testing in my environment, I noticed that properly configured database and cache connections are critical for handling larger file uploads. When these services aren't properly synchronized or configured, it appears the upload process fails early with very small size limits. To address this and similar environment-related issues, I've already submitted a Docker-based solution in PR #12182 and #12181 that:
For this specific image upload issue, the solution requires configuring both:
I'd be happy to submit a separate PR specifically for this upload size issue if the team would find that helpful. The Docker solution I've already submitted would help ensure developers don't encounter these types of environment sync issues in the future, as everything is properly configured and synchronized out of the box with a simple Would appreciate any feedback from the Medusa team and contributors on either approach. |
One way to solve that would be to introduce a custom middleware config: // src/api/middlewares.ts
import { defineMiddlewares } from "@medusajs/framework/http"
import type { MiddlewaresConfig } from "@medusajs/framework"
const UPLOAD_SIZE_LIMIT = "10mb";
export const config: MiddlewaresConfig = {
routes: [
{
matcher: "/admin/uploads",
method: ["POST"],
bodyParser: {
sizeLimit: UPLOAD_SIZE_LIMIT,
},
middlewares: [],
},
],
}
export default config |
Package.json file
Node.js version
v20.17.0
Database and its version
6.4.3
Operating system name and version
Ubuntu 20.04.6 LTS
Browser name
Google Chrome
What happended?
When i upload really small images like under 4kb they get uploaded but anything bigger i get those following errors.
Anyone know why? is there a default file limit?
Expected behavior
Uploading of all images
Actual behavior
Also i noticed when the small iamges are uploaded i see somehting in the server logs happening, but with the failing bigger images nothing comes in. like the backend server is not even being reached.
Link to reproduction repo
The text was updated successfully, but these errors were encountered: