Skip to content

Security basics

"The object exceeded the maximum allowed size" in Supabase Storage

"The object exceeded the maximum allowed size" means a Supabase Storage limit refused the file. Which of two limits did it, and how to raise it.

Vlad Tkachenko9 min read
A suitcase too wide for the metal sizer at a bag drop, resting on top of the frame instead of inside it, with its tag hanging down.

In short

  • "The object exceeded the maximum allowed size" means Supabase Storage refused your file because it is bigger than the largest file that bucket takes. Nothing was stored.
  • Two limits decide it, the project's global limit and the bucket's own, and the smaller one wins. On the free plan neither can go above 50 MB.
  • A size check in your upload form only stops your form. Anyone holding your publishable key can send a file straight to Storage, so the limits set on the bucket are the ones that count.

Somebody using your app picks a long video or a scanned contract, presses upload, and nothing happens. In your browser's Network tab, the upload request answered with this:

{
  "statusCode": "413",
  "code": "EntityTooLarge",
  "error": "Payload too large",
  "message": "The object exceeded the maximum allowed size"
}

"The object exceeded the maximum allowed size" is Supabase Storage, the part of Supabase that keeps your app's files, refusing a file because it is bigger than that bucket will take. It reads the same whether your app came from Lovable, Bolt, v0, Cursor, Claude Code or Replit. The file was not stored, and nothing already in the bucket changed.

Supabase's own table of Storage errors gives one fix for it, raising the limit in your project's storage settings, and that is half of one. Two limits produce this message, and raising the one you found does nothing while the other stays lower. The other fix people reach for, a size check in the upload form, makes the message rarer for your own users and stops nobody else.

What does "The object exceeded the maximum allowed size" mean?

It means the file was larger than the largest file Supabase Storage would accept for that bucket, so Storage turned it away.

The sentence is written into Storage's own code. The list of Storage errors gives it the code EntityTooLarge, the label "Payload too large" and the status 413, the web's standard number for a request that is too large. Your app's supabase.storage.from(...).upload(...) call gets it back as an error whose message is that sentence and whose statusCode is "413". In current versions of supabase-js, error.code reads EntityTooLarge as well.

One detail sends people looking in the wrong place. In your browser's Network tab the request shows 400, not 413. Storage's error handler sends this refusal as a 400 and carries the real number in the body. Read the body.

Nothing was kept. When an upload is refused, the uploader throws away whatever part of the file arrived and records nothing, so the bucket looks exactly as it did before you pressed the button.

Think of Storage as an airline's bag drop, where every file is a bag. In front of the belt stands a sizer, the metal frame a bag has to fit inside before the belt takes it, and this message is what the counter says when a bag does not.

Two limits, and the smaller one wins

Every upload is measured against two limits: your project's global file size limit and, when it has one, the bucket's own. Storage uses whichever is smaller.

That rule is one line in the uploader, which takes the bucket's limit and the global limit and keeps the lower. Supabase's file limits page sets how high each can go:

LimitWhere you change itHow high it can go
The global file size limitStorage Settings in your Supabase dashboard50 MB on Free, up to 500 GB on Pro and Team, custom on Enterprise
A bucket's own limitThe bucket's Edit bucket window, Restrict file sizeNo higher than the global limit

At the airport, the global limit is the airline's rule for your ticket, and a bucket's limit is a smaller frame at one particular counter. A bag that meets the airline's rule can still be stopped at a counter with a tighter frame, and raising the airline's allowance does not widen that frame.

So raising the global limit in Storage Settings, the fix in Supabase's error table, changes nothing when the bucket carries a smaller limit of its own. If your bucket was made from Supabase's own bucket example, it does: that example creates an avatars bucket with fileSizeLimit: '1MB'.

Every file passes two frames in a row. Widening the tall one does nothing for a case the short one stops.

Why can I get this error without uploading a file?

Because Storage gives the same answer when a bucket is created or edited with a limit above the project's global one.

The code that saves a bucket compares the limit the bucket asks for with the global limit and refuses with EntityTooLarge when it is bigger. The message still talks about an "object", although no file was sent. On the free plan it is an easy one to meet. A line like createBucket('videos', { fileSizeLimit: '100MB' }) in your app's setup code asks for twice what the plan allows, and the bucket is never made.

Supabase's dashboard catches this case and says it plainly: its Edit bucket window answers "Exceeds global limit of" and the figure, with a link to Storage Settings. A call from your app's own code gets the raw sentence instead.

How do I fix "The object exceeded the maximum allowed size"?

Find the smaller of the two limits, then raise it or make the file fit under it.

  1. Open Storage Settings and read the global file size limit.
  2. Open the bucket's Edit bucket window and read Restrict file size. With the switch off, the bucket has no limit of its own and the global one applies.
  3. If the bucket's limit is the smaller one and too low for what your app takes, raise it, as far as the global limit.
  4. If the global limit is the smaller one, the plan decides. On Free it cannot go above 50 MB, so the file has to get smaller or the project has to move to a paid plan. On Pro the documentation says you "can set this value to up to 500 GB", and it stays a setting: upgrading raises the ceiling, and you still change the number yourself.
  5. Make large files smaller before they leave the browser where you can. Resizing a photo in the app works on every plan.

For big files Supabase recommends its resumable upload above 6 MB "for better reliability", in its guide to standard uploads. That changes how the file travels and not how large it may be. The same two limits apply, and the resumable route refuses in words of its own.

Four refusals look alike. All of them come from the Storage server:

What you seeWhat refused itStatus
The object exceeded the maximum allowed sizeA standard upload over the limit, or a bucket limit set too high400, with "statusCode": "413" in the body
Maximum size exceededA resumable upload over the limit413
The user_metadata exceeded the maximum allowed sizeToo much extra information sent along with the file400, with "413" in the body
mime type application/pdf is not supportedThe bucket's list of allowed file types400, with "415" in the body

A size check in your upload form is not a limit

It stops your form and nobody else. The limits that count are the ones set on the bucket.

Your app talks to Storage straight from each visitor's browser, using the publishable key (sb_publishable_…, or anon in older projects) that sits in the code of every page, which is where it belongs. Anyone who opens your site can copy that key and send a file to your bucket without loading your form at all. A check written in the form, such as "refuse anything over 10 MB" or "images only", never sees that request.

At the airport, your form's check is the scale in your hallway. It saves you a surprise at the counter, and the airline never asks what it said. The frame at the counter decides.

The check in your form only meets people who use the form. A request in code goes to the bucket, and only a frame on the bucket stops it.

The bucket's type list has an edge of its own. Storage compares the type the upload declares, the Content-Type sent with it, against the list, and the uploader takes that type from the request rather than from the file's contents. So a bucket restricted to image/* refuses an upload labelled as a PDF and accepts any file labelled as an image. The counter reads the tag on the bag and never opens the bag. Keep the type list as a guard against honest mistakes, and decide who may upload at all somewhere else.

That somewhere is the bucket's rules, which neither limit touches. Who may put a file into a bucket is decided by insert rules on storage.objects, the subject of the "row-level security policy for table objects" error. A bucket whose rule lets anybody upload, with no size limit of its own, takes a stranger's files, each as large as the global limit allows, and every one counts against your plan's file storage. If that bucket is also public, anyone with a file's address can open it. You find out from a usage warning, or from files in a bucket that nobody on your side uploaded.

Part of this can be seen from outside. Our free scan asks the buckets your app's code names, and the common ones, whether they will list what is inside to a visitor with no login, and reads only the answer. It takes about 20 seconds and needs no account: scan your app.

Keeping your buckets the way you set them

Two things are worth having after today: something that notices when a later edit loosens a bucket, and a copy of the files your users upload. Supabase's own backups page says its database backups "do not include objects you store via the Storage API".

Reeve Monitor keeps checking from outside:

  • the full security check every hour, including whether any of your buckets lists its files to a visitor with no login
  • an alert the day a re-scan grades your app lower than the one before
  • whether the app is up, every 60 seconds
  • a monthly report of what it saw, your security grade included

Reeve Care keeps a copy of your Supabase database and its files:

  • an encrypted copy on a schedule, on Reeve's own storage in the EU, outside your Supabase account
  • the files in your buckets as well, once you connect a Storage credential
  • each copy verified before it counts, by counting the rows in every table
  • a one-click restore, with a safety copy of the current state taken first
  • everything Monitor does

What to do now

What to do

  • Read the response body, not the status line. "statusCode": "413" with EntityTooLarge is this limit, whatever the Network tab shows.
  • Read both limits, the global one in Storage Settings and the bucket's under Restrict file size, and change the smaller.
  • On the free plan, plan for 50 MB per file. Make files smaller before they upload, or move the project to a paid plan.
  • If the error appears when a bucket is created, the bucket asked for more than the project allows. Lower the number in that call.
  • Set the size and type limits on the bucket itself. A check in your form is a courtesy to your users.
  • Read the insert rules on storage.objects to decide who may upload at all.

If the upload fails with a sentence about row-level security instead, that error is the next one along. The 10-minute security checklist covers what else tends to be left open in a newly launched app.

FAQ

What does "The object exceeded the maximum allowed size" mean in Supabase?

It means Supabase Storage refused a file because it was bigger than the largest file the bucket accepts. Storage answers with the code EntityTooLarge and a status of 413 in the response body, although the request itself shows 400 in your browser. The file was not stored and nothing already in the bucket changed.

What is the maximum file size on the Supabase free plan?

Supabase's file limits page says the global file size limit "can't exceed 50 MB" on Free projects. On the Pro plan and up you can set it as high as 500 GB in Storage Settings, and Enterprise is custom. Every bucket can set a lower limit of its own, never a higher one.

I raised the file size limit and still get the error. Why?

Because there are two limits and Storage uses the smaller one. If you raised the global limit in Storage Settings, the bucket may still carry its own lower limit, set when it was created. Open the bucket's Edit bucket window and read Restrict file size. If you raised the bucket's limit, the global one may be the lower of the two.

Why do I get this error when creating a bucket?

Because the bucket asked for a file size limit above your project's global limit. Storage refuses that with the same sentence, even though no file was sent. On the free plan any bucket limit above 50 MB does it. Lower the number in the createBucket call, or raise the global limit first on a paid plan.

Does checking the file size in my upload form protect my bucket?

No. It stops your own form. Your app uploads with the publishable key that is in every page it sends to a browser, so anyone can copy the key and send a file to Storage without your form. Only the size and type limits set on the bucket, and the upload rules on storage.objects, apply to that request.

Written by

Vlad Tkachenko

Founder, Reeve

I spend my time looking at apps built with Lovable, Bolt, v0, Cursor and Replit, and at the short list of mistakes that keep turning up in them.

More about the author

Read next

All articles

Back up your Supabase database before your next change

Reeve keeps an encrypted copy on a schedule and restores it for you if something breaks.

See Supabase backups

Automated external check, not a full audit. Absence of findings is not a guarantee of safety.