Error when retrieving databsese data when using mobile device

Hi

Created a very basic app with a PostgreSQL database hosted on Render. The app works as it should if accessed via a desktop browser, but cannot retieve the database data when accessed via a mobile device.

Did a screenshot of mobile debug (see attached). Comes back with a ‘Connection Refused’ error, but it works correctly on the desktop?

I tried fetching with the URL as well, but it doesnt help:
// Fetch items from the backend
useEffect(() => {
fetch(“http://localhost:5000/api/items”)
.then((response) => response.json())
.then((data) => setItems(data))
.catch((error) => console.error(“Error fetching data:”, error));
}, );

I cannot see why it should be different for a mobile device. I get the error when the mobile device is connected to the same network as the desktop (while the desktop works fine), as well as when the mobile device is on mobile data.

Any suggesstions would be appreciated.

Thanks

You’re connecting to localhost:5000. You should be connecting to your production database, not localhost.

This is not a Netlify issue.

You are correct. I actually had a local database running, thats why it worked. Problem is connecting to the render database.
I can connect to the database using DBeaver, but get the following error when using Postman:
GET https://dpg-cqri988gph6c739vmtc0-a.oregon-postgres.render.com/api/items

Error: connect ETIMEDOUT 35.227.164.209:443

:arrow_forward:Request Headers

User-Agent: PostmanRuntime/7.31.1

Accept: /

Cache-Control: no-cache

Postman-Token: ca1892f1-5962-4b45-9146-f370da0ec61f

Host: dpg-cqri988gph6c739vmtc0-a.oregon-postgres.render.com

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

How is this a question that we can answer? You’re getting issues when connecting to Render. Could you please contact them?