← All guides

Supabase "TypeError: Failed to Fetch": Find the Real Cause From One Request

SupabaseLovableBolt

You press Log in and nothing happens, or a red toast says TypeError: Failed to fetch. A list that loaded yesterday stays empty. You paste the message into the AI chat, it rewrites the login form, yet the error stays.

That message means a request to Supabase didn’t produce an answer the browser would hand to your code. It says nothing about the password, the table or the code the AI just changed. The possible causes need different fixes: a wrong or stale address in the live build, a paused project, an Edge Function without CORS handling, an ad blocker, a filtering network. One row in your browser’s Network panel tells them apart. This guide shows how to read that row, then covers each cause and where to look whether the app lives in Lovable, in Bolt or on your own hosting; our Supabase, Lovable and Bolt tool pages gather related guides for each platform. Where we already have a deeper guide on a cause, the section links to it rather than repeating it.

What “Failed to fetch” actually tells you

Every login, query and function call from supabase-js goes out through the browser’s fetch(). MDN’s reference for fetch() separates two outcomes. If a server answers, even with a 404 or a 504, the promise resolves and your code gets a response to inspect. The promise rejects with a TypeError only when no usable response arrives: the address is invalid, the request is blocked, or the network fails.

So “Failed to fetch” means one of these:

  • The request never left the browser (an extension or a browser rule stopped it).
  • It left but found nothing to talk to (a host name that doesn’t exist, no connection).
  • A server answered, but the browser refused to hand the answer to your page (a CORS failure).

Your code can’t tell which one happened. MDN’s page on CORS errors notes that, for security, JavaScript learns only that the request failed; the reason goes to the browser console. So the AI can’t fix it from the error text: the text is identical for every cause.

The wording also depends on the browser. Chrome says Failed to fetch; its source throws a TypeError with exactly that text (Chromium fetch_manager.cc). Safari’s engine uses TypeError: Load failed for the same rejection; you can see it in WebKit’s own test output next to a request blocked by an access check (WebKit bug 259160). If a customer on an iPhone reports “Load failed” while your laptop shows “Failed to fetch”, treat them as the same problem until the Network row says otherwise.

How Supabase’s client passes it on

The error reaches your app in different wrappers depending on which part of Supabase you called. This comes from the supabase-js source:

CallWhat your code receives when fetch() throws
Sign-in, sign-up, sessions (supabase.auth...)An AuthRetryableFetchError carrying the browser’s message, status 0 (auth-js fetch.ts)
Table queries (supabase.from(...))An error object whose message is TypeError: plus the browser’s own text (TypeError: Failed to fetch in Chrome), with status: 0 (postgrest-js PostgrestBuilder.ts)
Edge Functions (supabase.functions.invoke)A FunctionsFetchError with the message Failed to send a request to the Edge Function (functions-js types.ts)

Status 0 is the clue: no HTTP status came back. The same AuthRetryableFetchError is also used when Auth does answer with a 500 to 504 (or a 520 to 530 gateway code), and then the status field carries that number. That case is covered further down.

Read one request in the Network tab

You need a desktop browser and about two minutes. The steps below use Chrome, whose Network panel guide and Network features reference document every control mentioned here.

  1. Open the live site where the error happens (not the AI builder’s preview, unless that’s where it fails).
  2. Open DevTools with Control+Shift+J (Command+Option+J on a Mac) and switch to the Network tab.
  3. Tick Preserve log so the list survives a redirect after login, and click the Fetch/XHR filter to hide images and scripts.
  4. Repeat the action that fails.
  5. Find the row whose name or address contains supabase.co (or your own domain, for server code on newer Lovable apps). Click it, open its Headers tab and read the full address in the General section.
  6. Read that row’s Status column, plus the matching error line that appeared in the Console tab.

Chrome’s reference lists what the Status column can hold: a normal HTTP code, CORS error, (blocked:origin) with a tooltip hint, or (failed) followed by an error code. The net::ERR_ codes after (failed) are defined in Chromium’s network error list, which is where the meanings in the table below come from.

The address tells you which Supabase service was called: /auth/v1/ is sign-in and sessions, /rest/v1/ is your tables, /functions/v1/ is an Edge Function, /storage/v1/ is files.

What the row tells you

What you seeWhat it points toWhere to check in an AI-built app
No request to supabase.co at all; the console says supabaseUrl is required.The project URL is missing from this buildLovable: VITE_SUPABASE_URL in .env. Bolt: the locked database values in .env. Your own host: its environment variable settings, then rebuild
A 404 or HTML from your own domain, with undefined in the pathThe same missing variable, in a hand-built URL (not a fetch failure, but the same fix)Search the code for functions/v1 and import.meta.env
(failed) net::ERR_NAME_NOT_RESOLVED on xxxx.supabase.coNo such project address, or a network’s DNS hides itCompare the subdomain with your project’s URL in Supabase’s Connect dialog
A project ID you don’t recogniseA copy or remix still calling the original projectThe client file and .env in the copy
Status 540A paused Supabase project (the code Supabase documents for it)Supabase dashboard; on Lovable Cloud, the paused card
CORS error on /functions/v1/...The function didn’t answer the preflight, crashed early, or doesn’t existEdge Function logs
(failed) net::ERR_BLOCKED_BY_CLIENTBlocked inside the browser (extension or setting)Extensions; test in a clean window
(failed) net::ERR_INTERNET_DISCONNECTED, ERR_CONNECTION_TIMED_OUT or ERR_CONNECTION_RESETThe connection itselfAnother network
Request URL starts with http:// while the site uses https://Mixed content, blocked by the browserThe URL value in .env or host settings
Status 500 to 504 on /auth/v1/...Supabase Auth answered with an errorstatus.supabase.com, then Auth settings
Status 401Supabase answered, so a key or token problem, not a network oneThe key value in .env, then the response body
A 500 from your own domain on a newer Lovable appA server function or API route failedLovable’s Server logs

Each row has its own section below. If two rows seem to fit, work down the table in order: the early rows are quicker to rule out.

The Supabase URL or key is missing from the live build

Supabase’s client needs two values: a project URL and a key, either the publishable key or the older anon key. In a Vite-based app, only variables named with a VITE_ prefix reach the browser, and their values are written into the JavaScript at build time (Vite: env variables and modes). Next.js treats NEXT_PUBLIC_ variables the same way, fixing their values at build time (Next.js: environment variables).

When the URL is missing, the client refuses to start: the supabase-js source throws supabaseUrl is required. before any request is made, and a value without http:// or https:// in front gets an “Invalid supabaseUrl” error instead (supabase-js helpers.ts). A missing key fails the same way with supabaseKey is required. (supabase-js SupabaseClient.ts). A blank page with either message is this cause, not a network fault. Code that builds an address by hand, such as ${import.meta.env.VITE_SUPABASE_URL}/functions/v1/send-email, fails differently when the variable is unset: the request goes to a path starting with undefined on your own site, and you get a 404 or an HTML page back instead of Failed to fetch. Same root cause, same fix.

Where to fix it:

  • Lovable. The browser values VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY live in the project’s .env file, which you can open in the code editor. Lovable’s Secrets page says VITE_ values belong in .env, not in Secrets, and that .env must stay committed so builds can read it. If you host the app outside Lovable, its external hosting guide says to set both values before the build runs, because they are baked in then. The same page lists server-side copies, SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY, that newer apps’ server code reads, so a self-hosted TanStack Start app needs those set too.
  • Bolt. When a project has a database, Bolt fills in the connection values in .env itself and locks them against hand edits. To point the app at another database, Bolt’s secrets and environment variables page sends you to the database’s Advanced settings rather than the file.
  • Vercel, Netlify or another host. Add the variables in the host’s settings for the right environment, then trigger a fresh build. Our 404 and env variable guide covers the prefix rules and why a redeploy is needed after any change.

Then reload the live site and check the request again.

The app points at the wrong project

The URL can be present and still wrong. Three patterns produce this:

  • A typo or a made-up project ID. A Supabase host name that matches no project doesn’t resolve. When we looked up an invented project subdomain on 4 December 2026, public DNS answered that the name doesn’t exist, which Chrome reports as ERR_NAME_NOT_RESOLVED (Chromium’s error list: the host name couldn’t be resolved).
  • A remix or copy. Lovable’s remix page says a copy that contains a service’s address still sends requests to it, and that a copy created through the Lovable API may still target the original project’s backend, which you should look at before using the copy. If the original project is later deleted or paused, those calls fail.
  • Migrating to a different Supabase project. Afterwards, an old URL can survive in .env, in host settings or hard-coded in a client file.

To check a project you own, open it in the Supabase dashboard and use the Connect dialog, which shows your project’s URL and key, ready to copy (Supabase: API keys). Compare the subdomain letter for letter with the one in the failing request. Then search the code for supabase.co so you catch any copy the AI hard-coded outside .env.

The project is paused

A paused project stops answering everything at once: login, data and functions. Supabase’s HTTP status codes page reserves status 540 for this, and says the project stays unavailable until its owner restores it. Supabase may pause a Free Plan project when it sees little activity over seven days; Supabase’s project pausing page explains the rule and the Resume project button in the dashboard.

Lovable Cloud has its own pause, separate from Supabase’s. Lovable’s pause and resume page lists the reasons (inactivity, a pause you started, credits running out, hitting a usage limit, an unpublished app, excessive usage) and says visitor traffic doesn’t wake the project. A paused card shows up on the Database, Users and Storage screens, naming the reason and the button that clears it. An inactivity pause ends once you open the project in the editor.

Whatever the Status column shows, the dashboard or the paused card settles it. Our paused project guide covers restoring, the one-year limit and what to test afterwards.

CORS on an Edge Function

When the failing row’s address contains /functions/v1/ and the Status column says CORS error, the browser received something from the function but refused to pass it on. Supabase’s guide to CORS in Edge Functions explains that a function called from a browser has to answer the OPTIONS preflight and send CORS headers, either through the withSupabase wrapper or by hand.

Missing headers aren’t the only trigger, though. Supabase’s own troubleshooting pages describe two cases where the browser blames CORS for something else:

  • A function name that doesn’t exist on the project returns a platform 404, which browsers report as a CORS failure, leaving supabase-js with only its generic Failed to send a request message (Edge Function 404 page).
  • A function that throws or returns before its CORS handling runs produces the same browser message, though the real problem is the crash (Edge Function 500 page).

Open the function’s logs before touching headers. In Lovable Cloud, that’s More → Database → Manage → Edge functions, then the function and View logs (Lovable: edge functions). Our Edge Function non-2xx guide has the CORS fix itself and the checks for each status code, so we won’t repeat them here.

Newer Lovable apps may have no Edge Functions

Lovable’s edge functions page says apps created on or after 13 May 2026 use TanStack Start, which keeps backend code inside the app (server functions, API routes). A newer app may contain zero Edge Functions. Those calls go from the browser to your own domain, not to supabase.co, so the Edge Function CORS setup above isn’t involved. If such a call fails, the row shows your domain, and the reason is on the server: Lovable’s logs page says the Logs view (More → Settings → Logs) opens on Server logs for these apps, with the messages your server code logged and any crashes. Upgraded apps may contain both kinds, so check both log types if you aren’t sure.

A key problem looks different

If the row shows a status such as 401, Supabase did answer, so by MDN’s rule above this isn’t a fetch failure: read the response body and look at the key. One example from Supabase’s API keys page: a secret key used from a browser gets a 401, because Supabase recognises the browser by its User-Agent header. If you’re switching to the new publishable and secret keys, our legacy API keys guide lists the errors a missed key produces.

Ad blockers, extensions, VPNs and company networks

If the row says (failed) net::ERR_BLOCKED_BY_CLIENT, the browser itself declined to send the request; Chromium’s error list describes that code as the client choosing to block it. Ad blockers and privacy extensions come first. Supabase has a short troubleshooting note about one CORS-related extension that blocks PATCH requests by default, which it ties to “update code” failing with the same message.

Networks can block too: a work or school firewall, a VPN, or DNS filtering. The failure follows the network instead of the browser. The tests below separate the two.

Test it the way the affected user sees it:

  1. Same browser, private window, extensions switched off. If it works, an extension is the cause; turn them back on one at a time to find which.
  2. A phone with Wi-Fi turned off, so it uses mobile data. If it works there but not on the office Wi-Fi, the network is filtering the request.
  3. A different browser on the same machine.

If the app works everywhere except one user’s browser or network, your code is fine and the fix is on their side. Show a clear message in your app when this happens instead of a button that silently does nothing; isAuthRetryableFetchError from supabase-js lets your login code spot this case (auth-js errors.ts).

You may read advice to serve your API from a Supabase custom domain so blockers don’t recognise supabase.co. Supabase’s custom domains page describes the paid add-on as a branding feature and says nothing about blockers or filtered networks, so we can’t promise it helps. Try the tests above first.

An http:// address on an https:// site

A published site runs on https://. If the Supabase URL in your build starts with http://, the browser stops the call. MDN’s mixed content page lists fetch() requests among the insecure requests browsers block outright on secure pages, rather than upgrading them.

The fix is the value, not the code: put the https:// project URL from the Connect dialog into .env or the host’s settings and rebuild. A localhost address in a published app is a related mistake: a development value was shipped, and a visitor’s browser can’t reach your laptop. Search the code and every environment file for it.

Supabase itself is having trouble

When the row shows 500, 502, 503 or 504 on an /auth/v1/ address, the request reached Supabase and Auth replied with an error. Supabase’s status codes page puts 5xx responses on the project side, for example a project without enough compute for the request load. The client wraps these in an AuthRetryableFetchError that carries the real status, so your app may still display something close to “failed to fetch”.

Work through it in this order:

  1. status.supabase.com. It lists Auth and each region separately, and you can subscribe to updates. Check the row for your project’s region.
  2. A 503 on every Auth request in your own Supabase project. Supabase’s 503 AuthRetryableFetchError note traces one known case to an invalid value in the session Timebox setting, which stops Auth from starting. Their fix is to set a valid duration, or the default, in the dashboard’s Sessions settings.
  3. The project’s logs. The status codes page says response codes are visible in the Logs Explorer. If a failing request appears there, it reached Supabase.

On Lovable Cloud you don’t get the Supabase dashboard; use Lovable’s Logs view instead. Our Lovable authentication errors guide explains how to check whether Lovable is down or your app is broken.

Stop the AI from “fixing” code that works

Paste “TypeError: Failed to fetch” into an AI builder and it has nothing to go on, so it guesses: a new login form, a retry loop, CORS headers on code that isn’t a function. Each guess can cost credits and break something that was fine. Give it the evidence instead. Something like:

On the published site, the orders page shows “TypeError: Failed to fetch”. In Chrome’s Network tab the request is GET https://abcd1234.supabase.co/rest/v1/orders and its Status is (failed) net::ERR_NAME_NOT_RESOLVED. My project’s URL in the Supabase Connect dialog is https://abcd5678.supabase.co. Find every place this app sets the Supabase URL and list them. Don’t change any login code.

Swap in your own row: the exact address, the exact status, what you checked, and a limit on what it may edit. If the row points outside the code (a paused project, an extension, a filtered network), no prompt will fix it.

FAQ

Why does login work for me but fail for other users?

Their browser, extensions and network differ from yours. Run the three tests in the ad blocker section with them. If the failure follows the user to every device and network, look at account problems instead; our Lovable authentication errors guide indexes login messages by wording.

Why does it work in Lovable’s preview and fail on my domain?

Check what differs between the two builds. If you host outside Lovable, the host needs its own VITE_SUPABASE_URL and key set before the build. If you published from Lovable, make sure the latest version was published, since server functions and API routes go live only on publish. Then compare the Request URL in both: an Edge Function whose Access-Control-Allow-Origin header names one origin can accept the preview’s address and reject your domain (MDN: CORS errors). The preview versus published FAQ covers the login-specific cases.

Is “Failed to fetch” a Supabase outage?

Not necessarily. When Supabase answers with an error, the row shows a 5xx status; when it can’t be reached at all, the row shows (failed) like any other network fault. Check status.supabase.com for your region, but read the Network row too: a paused project, a stale address or a blocker on your side produces the same error text.

What’s AuthRetryableFetchError?

The error type Supabase’s auth client uses when a request got no normal Auth reply. With status: 0, fetch() threw (network, blocking or CORS); with a 5xx status, Auth answered with an error. Either way it says nothing about the user’s password. The definitions are in auth-js fetch.ts.

Can a CORS error really come from my own function crashing?

Yes, as the Edge Function section above explains: a crash before the CORS handling runs, or a function name that doesn’t exist, both get reported by the browser as a CORS problem. Read the logs first; the non-2xx guide walks through it.

Comments

Add a comment

Generated for you. Click to type your own.

Required. Never shown on the page. Privacy policy.

Basic markdown: **bold**, *italic*, `code`, lists, quotes, and fenced code blocks. HTML shows as plain text.

Your draft stays on this device until you post.