Deno "Cannot resolve module ... offline" in CI
Deno needed to download a remote module but the network was unreachable and the module was not in DENO_DIR. In CI this is usually a blocked egress, a proxy, or a cache that was not restored.
What this error means
The run fails with "error: Cannot resolve module \"https://...\"" or "error: Import ... failed: error sending request" when fetching a remote specifier.
error: Import "https://deno.land/std@0.224.0/path/mod.ts" failed: error sending request for url (https://deno.land/std@0.224.0/path/mod.ts): client error (Connect)Common causes
Blocked or proxied network egress
The runner cannot reach the remote host directly (firewall or required proxy), so the fetch fails.
No restored cache to fall back on
DENO_DIR was not restored, so Deno has no local copy and must reach the network, which is unavailable.
How to fix it
Restore the cache or allow egress
- Restore DENO_DIR so remote modules are available offline.
- Or configure the proxy the runner needs to reach the host.
- Re-run so resolution succeeds.
export HTTP_PROXY=http://proxy.internal:3128
export HTTPS_PROXY=http://proxy.internal:3128
deno cache main.tsVendor or pre-cache dependencies
Populate DENO_DIR in a network-enabled step, then run the offline step against the restored cache.
- run: deno cache main.ts
- uses: actions/cache/save@v4
with:
path: ~/.cache/deno
key: deno-${{ hashFiles('deno.lock') }}How to prevent it
- Restore DENO_DIR so remote modules do not need refetching.
- Configure required proxies for runners without direct egress.
- Pre-cache or vendor dependencies before offline steps.