Deployed Function provides different data than Local/Dev Environment

Site: https://delicate-moonbeam-907a24.netlify.app

I have a simple web app built with the Astro web framework. Currently the objective of this web app is to ping the availability of a list of websites. When I test my function via the netlify-cli, it uses the ping function from the @network-utils/tcp-ping package to ping the availability of a provided url. See screenshot below:

For testing purposes, I will use an example website: www.ag.gov.ws
When I test locally, I get this result always:

http://localhost:8888/.netlify/functions/ping?url=www.ag.gov.ws
{ status: false }

However when I deploy to production, the same url query returns true instead. But when I actually visit the website on the browser, it is indeed offline/unavailable. See below:

https://delicate-moonbeam-907a24.netlify.app/.netlify/functions/ping?url=www.ag.gov.ws
{ status: true }

Locally, I always get the current results but in production, lots of sites that are unavailable return a true status. I read in the forum that functions don’t cache results. So I’ve been stuck trying to figure out the issue. Any help is greatly appreciated.

Thank you!

SOLUTION: Turned out on my local machine, I couldn’t reach the sites because of DNS issues. Whereas the deployed solution could reach most of the sites I couldn’t locally. So I would suggest any future readers with the same problem to configure your DNS settings on your local machine.

Hiya, I’m glad you found your solution!