Automattic / Automattic/studio
Windows: isOnline() false positive blocks site creation with specific WordPress versions (Node.js c-ares DNS regression)
- Dominant language
- TypeScript
- Stars
- 517
- Forks
- 95
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 172
Description
### Quick summary
On Windows 10, creating a site with a specific WordPress version (e.g. 6.8, 6.9) fails with “Cannot set up WordPress while offline”, even when the machine has a working internet connection. Creating a site with `latest` works.
Root cause: Studio’s `isOnline()` check (`tools/common/lib/network-utils.ts`) uses `dns.resolve()`, which fails on Windows when the bundled Node.js v24 reports DNS servers as `127.0.0.1` (known Node.js/c-ares regression: [https://github.com/nodejs/node/issues/62748]()). The OS resolver and system Node.js on the same machine work correctly.
This is **not** the same root cause as Automattic/studio#3153 (SSL/cURL certificate issue), which shows the same user-facing error message.
### Steps to reproduce
1. Install WordPress Studio **1.10.0** on **Windows 10** (build 19045).
2. Confirm internet works (browser, etc.).
3. Open Studio → **Add site** → choose a WordPress version other than `latest` (e.g. **6.8** or **6.9**).
4. Complete the form and create the site.
5. (Optional diagnostic) Run with Studio’s bundled Node:
```powershell
$node = "$env:LOCALAPPDATA\studio_app\app-1.10.0\resources\bin\node.exe"
& $node -e "console.log('getServers:', require('dns').getServers()); require('dns/promises').resolve('public-api.wordpress.com').catch(e=>console.log(e.code, e.message))"
```
6. (Optional) Compare with system Node:
```powershell
node -e "console.log('getServers:', require('dns').getServers()); require('dns/promises').resolve('public-api.wordpress.com').then(console.log)"
```
### What you expected to happen
The site should be created with the selected WordPress version when the machine has internet access.
### What actually happened
Site creation fails with:
```
Cannot set up WordPress while offline. Specific WordPress versions require an internet connection. Try using "latest" version or ensure internet connectivity.
```
Studio log excerpt:
```
[CLI - …] Checking WordPress version…
[CLI - …] Validating site configuration…
[CLI - …] Creating site directory…
Error occurred in handler for 'createSite': CliCommandError: [Last error message] Cannot set up WordPress while offline. …
```
On affected systems, bundled Node reports `getServers: [ '127.0.0.1' ]` and `dns.resolve()` returns `ECONNREFUSED`, while system DNS and `Resolve-DnsName public-api.wordpress.com` succeed.
Affected code path: desktop app forks bundled `node.exe` + `resources/cli/main.mjs` (`apps/studio/src/modules/cli/lib/execute-command.ts`), then `isOnline()` in `tools/common/lib/network-utils.ts` gates non-`latest` installs in `apps/cli/commands/site/create.ts`.
### Impact
Some (< 50%)
### Available workarounds?
No but the app is still usable
### Platform
Windows
### Logs or notes
**Environment**
* OS: Windows 10 (build 19045)
* Studio: 1.10.0 (commit `206258631711953a003bba8b933c0cf75e95baf7` from app logs)
* Locale: pt-BR
* System DNS: `192.168.0.1` (router)
* Bundled Node: v24.14.1 (c-ares 1.34.6) — `dns.getServers()` → `['127.0.0.1']`
* System Node: v22.5.1 — resolves DNS correctly
**Reproduction confirmed**
* Without workaround: WP **6.8** and **6.9** fail in Studio UI (2026-06-06 and 2026-06-10).
* With `latest`: succeeds.
* `latest` uses bundled files under `~/.studio/server-files/wordpress-versions/latest` and does not depend on `isOnline()`.
**Suggested fix (for maintainers)**
Replace `dns.resolve()` with `dns.lookup()` in `tools/common/lib/network-utils.ts`, since `lookup()` uses the OS resolver and is unaffected by the c-ares regression.
**Related**
* Upstream: [https://github.com/nodejs/node/issues/62748]()
* Studio (different cause, same error text): Automattic/studio#3153
* Studio offline UI behavior: [#1383]() (forces `latest` when `navigator.onLine === false`; does not cover this CLI false positive)
I am planning to submit a PR with a fix in `network-utils.ts` in the coming days.
Contributor guide
Research direction
Start with tools/common/lib/network-utils.ts and trace isOnline() through apps/cli/commands/site/create.ts and apps/studio/src/modules/cli/lib/execute-command.ts. Reproduce the Windows failure with the bundled Node DNS diagnostic and compare selected-version and latest flows. Done means affected Windows setups no longer report offline while existing latest behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, desktop, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100