To help troubleshoot it, the following code can be run in the debug console to get the currentSyncURL and its ip address.
currentSyncUrl = mw.pm.profile.get("currentSyncUrl") or 'https://sync.ankiweb.net/'
print("-----------------------------------------")
print(f"The currentSyncUrl is '{currentSyncUrl}'")
hostname = currentSyncUrl.replace('https://', '').replace('/', '')
import socket
try:
ip_address = socket.gethostbyname(hostname)
print(f"The IP address of '{hostname}' is {ip_address}")
except socket.gaierror:
print(f"Error: Hostname '{hostname}' could not be resolved.")
If it’s resolved successfully, the currentSyncURL can be opened in the web browser to check the connectivity.
If the web browser shows a blank page, then the connection was successful, the certificate is not expired and Anki should be able to sync too.