I have an application, accessing a PostgreSQL database via the DATABASE_URL environment variable.
I have a cron job, attempting to access the database via the same environment variable. For some reason, the cron job can’t resolve the domain. I keep getting the following error:
django.db.utils.OperationalError: could not translate host name “dpg-c9l77650mal5d4tm6j7g-a” to address: Name or service not known
I checked the DATABASE_URL in both the application and the cron job and they are exactly the same.
It’s also worth pointing out that if i SSH into the application server and run the job manually it works fine. It’s as if the CRON job doesn’t have network access to the DB.
Hey Jack,
That error smells very much like the 2 services aren’t in the same region. We don’t have cross regional network access so it would be worth checking if that.
Great - we’ve actually put some logic in place when services are created by the dashboard to highlight where you have services running to help you choose and we default the region picker to the region where you have the most services running - this isn’t surfaced when you create services via blueprints though but we should do better here to summarize what’s going to be created.