# Fix: Failed to Load Response Data in DevTools

> Fix the Chrome DevTools 'Failed to load response data' error by resolving a CORS misconfiguration or an incorrect request URL, with a code example

**URL:** https://sentry.io/answers/failed-to-load-response-data-no-data-found-for-resource-with-given-identifier/

---

## The Problem

When using browser dev tools, like Chrome DevTools, to investigate why a fetch request has failed, you may see the following error in the **Network** tab on the browser dev tools response panel:

```
Failed to load response data: No data found for resource with given identifier
```

This can be caused by [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests), if your frontend code and the API endpoint are served from different [origins](https://developer.mozilla.org/en-US/docs/Glossary/Origin) and you haven't set up CORS correctly.

It can also be caused by an incorrect request URL or a connection issue with the server.

## The Solution

If the issue is caused by cross-origin resource sharing (CORS), you'll see the following error in your browser dev tools **Console** tab:

```
Access to fetch at 'http://localhost:1338/api/sync' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
```

The [CORS header 'Access-Control-Allow-Origin' missing error](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin) indicates that you need to set up CORS on your server to allow your frontend to access your backend API resources. Add your frontend origin (URL) to the `Access-Control-Allow-Origin` header. In an Express app, you can install the [CORS](https://www.npmjs.com/package/cors) npm package and add an origin, as shown in the code below:

```js
import express from "express";
import cors from "cors";

const corsOptions = {
  origin: "http://localhost:5173"
};

const app = express();
app.use(cors(corsOptions));
```

You can use an API development platform, such as [Insomnia](https://insomnia.rest/) or [Postman](https://www.postman.com/), to test whether the fetch request has a CORS issue. The [same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) is a browser security measure that restricts resource fetching from different origins. Insomnia and Postman don't enforce CORS. To learn more, take a look at this Sentry answer: [Why does my JavaScript code receive a "No Access-Control-Allow-Origin header is present on the requested resource" error, while Postman does not?](https://sentry.io/answers/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-error-while-postman-does-not/).

If CORS isn't the issue, make sure that your API route exists.

If the request URL is incorrect, or if there is a server connection issue, you'll see a "Not Found" error in your browser dev tools **Console** tab:

```
POST http://localhost:1338/api/syncc net::ERR_FAILED 404 (Not Found)
```

### Note

You may only see the `Failed to load response data: No data found for resource with given identifier` error after multiple page reloads or page navigations if you're using the **Network** tab in the dev tools of a Chromium browser and have the [preserve log](https://developer.chrome.com/docs/devtools/network/reference#preserve-log) feature enabled. There is a Chromium issue about why some requests that initially show a response later show the error, after further page refreshes or navigation: [DevTools: XHR (and other resources) content not available after navigation](https://issues.chromium.org/issues/40254754).

---

*Source: [sentry.io/answers/failed-to-load-response-data-no-data-found-for-resource-with-given-identifier/](https://sentry.io/answers/failed-to-load-response-data-no-data-found-for-resource-with-given-identifier/)*
