fetch's no-cors mode, explained
You hit a CORS error, searched for the fix, and found mode: 'no-cors'. You added it, the TypeError went away, and the request looked like it worked. It didn't: no-cors doesn't add permission to read anything, it just stops the browser from telling you that you can't. We built two local origins and ran four fetches through a real Chromium page to see exactly what the mode changes, what it leaves alone, and one thing it silently rewrites that we didn't expect going in.
What mode: 'no-cors' actually promises
The fetch spec defines a handful of request modes, and 'no-cors' is the default for things like <img> and <script> tags: load a resource across origins without needing permission from the server, in exchange for never finding out what came back. Set it explicitly on a fetch() call and you get the same deal. The browser will still send the request. It just refuses to hand your JavaScript anything useful about the response: no status code you can branch on, no headers, no body. That's the entire trade, and it's a trade, not a workaround: you're not getting the cross-origin read you wanted, you're giving it up on purpose so the browser stops complaining about it.
What we tested
We stood up two plain Node HTTP servers on different local ports, 5501 and 5502, different ports making them different origins the same way a different domain would. Server 5502 plays the API: one path sends no CORS headers at all, one path sends a correct Access-Control-Allow-Origin, and one path only accepts a preflighted POST. Server 5501 serves a page that fetches across to 5502 four different ways, run in an actual Chromium page via Playwright, not Node's own fetch, because Node has no same-origin policy to enforce in the first place:
// running inside the page, origin http://127.0.0.1:5501
const a = await fetch('http://127.0.0.1:5502/no-cors-headers');
// TypeError: Failed to fetch
const b = await fetch('http://127.0.0.1:5502/no-cors-headers', { mode: 'no-cors' });
console.log(b.type, b.status, b.ok, [...b.headers.entries()].length, await b.text());
// opaque 0 false 0 ''
const c = await fetch('http://127.0.0.1:5502/with-cors-headers');
console.log(c.type, c.status, await c.json());
// cors 200 { hit: 1, path: '/with-cors-headers' }
That's the headline behavior working as documented. The plain fetch to an endpoint with no CORS headers throws. The same fetch in no-cors mode doesn't throw, but response.type is 'opaque', status is always 0, there are zero readable headers, and the body reads back empty even though the server sent a real JSON payload. response.ok is false too, which is easy to miss if your code only checks !response.ok to decide whether something went wrong, because a real failure and a successful-but-opaque response look identical by that check.
The request still reaches the server
The part that actually matters for debugging: we counted hits on the server side, independent of what the browser let the page read back.
Server-side hit counters after the run: {"noHeaders":2,"withHeaders":1,"preflighted":1,"preflightOptions":0}
Two hits on /no-cors-headers, not one. Both the plain fetch that threw a TypeError and the no-cors fetch that returned an opaque response actually executed on the server. CORS is not a network-level block; for a GET like this one, with no custom headers to justify a preflight, the request goes out and the server processes it regardless of what Access-Control-Allow-Origin comes back. The browser just won't let your script see the result unless that header says it can. no-cors mode doesn't change that part at all, it only changes whether the browser throws on the way to not letting you read it. That's specific to requests simple enough to skip a preflight; a method like PUT or DELETE, or a custom header, would have triggered one first, and a preflight the server answers with no Access-Control-Allow-Origin does stop the real request from ever being sent.
no-cors silently rewrites your request, too
This is the one we didn't expect. We pointed a fourth fetch, a POST with Content-Type: application/json, at a path that only accepts a preflighted request, with mode: 'no-cors' set:
const d = await fetch('http://127.0.0.1:5502/preflighted', {
method: 'POST',
mode: 'no-cors',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ x: 1 })
});
console.log(d.type, d.status); // opaque 0
No preflight ran at all; the server's OPTIONS handler never fired. The POST landed directly, logged here on the server side rather than read back through the opaque response:
[server] /preflighted received Content-Type: text/plain;charset=UTF-8 body: "{\"x\":1}"
We asked for application/json. The server received text/plain;charset=UTF-8 instead. A request in no-cors mode is restricted to CORS-safelisted header values, and application/json isn't one of the three safelisted Content-Type values; rather than throwing or sending it anyway, the browser drops our header and falls back to the same default text/plain;charset=UTF-8 it would use for any string body with no Content-Type set at all. No warning in the console, no exception anywhere in the call. The body still arrived as the JSON string we sent, but any server code that branches on Content-Type before parsing, which is exactly what express.json() and most JSON body parsers do by default, will skip parsing it. You'd see an empty or undefined body on the server with no record, on either side, of why.
When no-cors is actually the right call
There are legitimate uses for all of this: a fire-and-forget request where you genuinely don't need to read the response, an analytics ping, a webhook retry you're not waiting on, the default behavior of an <img> tag loading a cross-origin picture. In those cases you were never going to inspect the response anyway, so trading away the ability to is free. The failure mode is reaching for no-cors on a request where you do need the body or the status, because the error stops showing up in your console and starts showing up as silently missing data three steps downstream instead.
Fixing the error instead of hiding it
The actual fix for a CORS error is for the response to carry the right Access-Control-Allow-Origin, the way our own test's /with-cors-headers path does, which is what lets a plain fetch() read a real status and body instead of an opaque shell. If you control the server, that's a header to add; see how to allow CORS on any server. If you don't, and the API wasn't built to be called from a browser at all, that's what a CORS proxy is for: corsproxy.dev sits in front of the target and answers your browser's request (and its preflight, if the call needs one) with Access-Control-Allow-Origin: * itself, so the fetch you already wrote, no special mode required, gets back a real status and a readable body. A free key covers 100 requests a day for exactly that.