All guidesDeep-dive articles

Supabase Storage

Does Supabase Storage NoSuchKey mean missing or denied?

By Ohad Krispin, founder of VibeRaven · LinkedIn

Short answer

Supabase Storage can return a NoSuchKey 404 for a missing object or an object the caller cannot access. Check the exact project, bucket and object name in Storage metadata first. Then retry the authenticated download as the same user with a file you know that user can read.

On this page

Check the object key, then the user session

  1. 1
    In your test project's SQL Editor, compare the exact bucket ID and object name with the metadata. Replace both literals with the values used at upload. The name is relative to the bucket and includes every folder segment.
    SQL
    select bucket_id, name
    from storage.objects
    where bucket_id = 'private-docs'
      and name = 'receipts/April 2026.pdf';
  2. 2
    If there is no current metadata row, verify the project URL, filename case, bucket, folder, and the path the upload returned. Compare the raw key before URL encoding. If bucket versioning is enabled, distinguish the current object from archived versions. Read metadata via SQL and manage files via the Storage API.
  3. 3
    If there is a current row, save this as check-download.mjs. Set SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY and USER_ACCESS_TOKEN for your test project and ordinary test account. Run node check-download.mjs private-docs "receipts/April 2026.pdf", then repeat with a fixture that account is expected to read. The script prints status and error code only.
    Code
    const { SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, USER_ACCESS_TOKEN } = process.env;
    const [bucket, key] = process.argv.slice(2);
    if (!SUPABASE_URL || !SUPABASE_PUBLISHABLE_KEY || !USER_ACCESS_TOKEN || !bucket || !key) {
      throw new Error('Set the three environment variables and pass a bucket and raw object key.');
    }
    
    const path = [bucket, ...key.split('/')].map(encodeURIComponent).join('/');
    const url = new URL('/storage/v1/object/authenticated/' + path, SUPABASE_URL);
    const response = await fetch(url, {
      headers: {
        apikey: SUPABASE_PUBLISHABLE_KEY,
        authorization: 'Bearer ' + USER_ACCESS_TOKEN,
      },
      redirect: 'error',
    });
    const details = response.ok ? null : await response.json().catch(() => null);
    console.log({ status: response.status, code: details?.code ?? details?.error ?? null });
    process.exitCode = response.ok ? 0 : 1;
  4. 4
    If the known-good download also fails, check the session, project and access to that fixture first. If it succeeds and the target exists, compare the target's owner or folder with your storage.objects SELECT policy for authenticated downloads. If the exact object is still unavailable when the policy should allow it, inspect Storage logs and confirm the underlying file exists. The SQL row proves metadata exists.

Official docs behind this checklist

FAQ for builders before launch

Why does upload work but download returns Object not found?

Upload and download check different permissions. A successful insert does not prove that the same user can select the object for download.

Should I make the bucket public to fix NoSuchKey?

Keep a private bucket private. Correct the path or the SELECT policy for the intended user. Use a signed URL when the product intentionally grants time-limited access.