Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug failed to fetch in react-admin app

How to debug failed to fetch in react-admin app.

If I use http://jsonplaceholder.typicode.com it works, with custom API it doesn't work. The custom API is just a wrapper on top of typicode API so that I can replace one after one. The custom API works fine without any issues.

Any help in troubleshooting is appreciated.

const dataProvider = jsonServerProvider('http://xxxxxx/api');
//const dataProvider = jsonServerProvider('http://jsonplaceholder.typicode.com');
const App = () => (<Admin dataProvider={dataProvider}>
                    <Resource name="posts" list={ListGuesser}/>
                    <Resource name="users" list={ListGuesser} />
                    <Resource name="comments" list={ListGuesser} />
                    <Resource name="photos" list={ListGuesser} />
                    <Resource name="albums" list={ListGuesser} />
                    <Resource name="todos" list={ListGuesser} />
                </Admin>);
like image 788
gillijay Avatar asked Mar 18 '26 22:03

gillijay


1 Answers

This could be due to several factors, and to further diagnose I'd inspect the console and network requests in your browser.

I came across the following error in the console:

The page at was loaded over HTTPS, but requested an insecure resource This request has been blocked; the content must be served over HTTPS.

The solution was to change the URL of the dataprovider (jsonplaceholder) from http:// to https://

like image 115
user3200950 Avatar answered Mar 20 '26 13:03

user3200950



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!