Skip to content

Diagnostic reference

Exception: Address unavailable / DNS error

Fix Exception: Address unavailable and DNS error in Google Apps Script UrlFetchApp.fetch(): public HTTPS hosts, typos, TLS, and firewall rules.

Updated December 6, 2026

Apps Script error

Exception: Address unavailable: http://localhost:3000/webhook

What it means

Apps Script executes on Google's servers, never in your browser or on your laptop. UrlFetchApp.fetch() throws Address unavailable or DNS error when the URL points to localhost, 127.0.0.1, a private LAN IP (10.x, 192.168.x), an internal corporate hostname, a misspelled domain, or a server that drops connections from Google Cloud IP ranges.

Related error messages

  • Exception: DNS error: https://api.example.invalid/v1/items
  • Exception: Address unavailable: https://...
  • Exception: Attribute provided with no value: url

Before and after

The code before and after the fix.

Problem 2 changed lines
function pushWebhook(payload) {
  // Fails: Apps Script runs on Google's servers and cannot reach localhost or LAN IPs.
  return UrlFetchApp.fetch('http://localhost:3000/webhook', {
    method: 'post',
    contentType: 'application/json',
    payload: JSON.stringify(payload),
  });
}
Fixed 4 changed lines
function pushWebhook(payload) {
  const url = PropertiesService.getScriptProperties().getProperty('WEBHOOK_URL');
  if (!url) throw new Error('Set a public HTTPS WEBHOOK_URL in Script Properties.');
  return UrlFetchApp.fetch(url, {
    method: 'post',
    contentType: 'application/json',
    payload: JSON.stringify(payload),
    muteHttpExceptions: true,
  });
}

How to fix it

  • Replace localhost, 127.0.0.1, .local hostnames, and private RFC 1918 LAN IPs with a publicly reachable HTTPS URL (or a tunnel such as Cloudflare Tunnel during development).
  • Trim whitespace and check for empty strings when reading a URL from a cell or Script Property so you do not pass an empty url.
  • Verify the domain resolves in public DNS and uses a valid TLS certificate.
  • If the server sits behind a firewall or WAF, check whether it blocks Google Cloud outbound IPs.

Things to check

  • UrlFetchApp does not support custom VPC peering or private internal DNS zones.
  • myFunction flags localhost, .local, and private LAN URLs in UrlFetchApp calls statically under rule MF95028.

In the Apps Script editor

Catch errors like this before clicking Run.

myFunction (published as Error Checker for Google Apps Script on the Chrome Web Store) checks your code while you edit at script.google.com. Diagnostics, autocomplete, and rule-based quick fixes are free without an account, run in your browser, and request no Google Drive, Gmail, or Apps Script project OAuth scopes. Writing Apps Script with an AI coding agent? Connect the Apps Script MCP server to run the same static checks before pasting code.