Could not start Cloudflare tunnel: unknown error

I went through some similar topics, but they had a specific error. But for me, it’s showing an unknown error when I run npm run dev or shopify app dev, so it’s hard to fix it. How could I fix it for the long term?

Short term solution

I’ve set up Cloudflare CLI via homebrew, then I ran a quick tunnel, got the public URL, and ran the app with --tunnel-url including https:// and the port.

  1. Set up Cloudflare CLI and run a Cloudflare quick tunnel using localhost and the port below.
brew install cloudflared && \
cloudflared tunnel --url http://localhost:3000
  1. You will see the public URL in the middle of the output in your terminal, copy it.

  1. Open a new terminal tab, and your app root folder run:
npm run dev -- --tunnel-url https://eco-riding-pixels-connectors.trycloudflare.com:3000

Now you need to keep the two terminal tabs open, but it will work as before, with HMR and Shopify App URL updates.

Hi Rafael – if you run with --verbose then early in the logs you’ll see the output from the CLI launching cloudflared. That might give you a clue as to the issue.

1 Like

@rafael,

npm run dev -- --tunnel-url https://eco-riding-pixels-connectors.trycloudflare.com:3000

This is one is different from another one in terminal(2.)

If you are using static URL, you need to set DNS when run Cloudflare tunnel.
For example,

cloudflared tunnel --config .cloudflared/config.yml --url localhost:3000 run <your-dns>

This blog should be helpful.

That’s the output, it seems like a timeout.

╭─ info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                  │
│  Using shopify.app.toml for default values:                                                                                      │
│                                                                                                                                  │
│    • Org:             Rafael                                                                                                   │
│    • App:             app-remix                                                                                                │
│    • Dev store:       rafaelcg.myshopify.com                                                                                     │
│    • Update URLs:     Yes                                                                                                        │
│                                                                                                                                  │
│   You can pass `--reset` to your command to reset your app configuration.                                                        │
│                                                                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

2025-03-04T15:10:44.075Z: Port 3457 is free
2025-03-04T15:10:44.078Z: Polling tunnel status for cloudflare (attempt 0): starting
2025-03-04T15:10:44.078Z: Getting a random port...
2025-03-04T15:10:44.080Z: Random port obtained: 62141
2025-03-04T15:10:44.579Z: Polling tunnel status for cloudflare (attempt 1): starting
2025-03-04T15:10:45.079Z: Polling tunnel status for cloudflare (attempt 2): starting
2025-03-04T15:10:45.580Z: Polling tunnel status for cloudflare (attempt 3): starting
2025-03-04T15:10:46.081Z: Polling tunnel status for cloudflare (attempt 4): starting
2025-03-04T15:10:46.582Z: Polling tunnel status for cloudflare (attempt 5): starting
2025-03-04T15:10:47.081Z: Polling tunnel status for cloudflare (attempt 6): starting
2025-03-04T15:10:47.582Z: Polling tunnel status for cloudflare (attempt 7): starting
2025-03-04T15:10:47.586Z: 2025-03-04T15:10:47Z INF +--------------------------------------------------------------------------------------------+
2025-03-04T15:10:47Z INF |  Your quick Tunnel has been created! Visit it at (it may take some time to be reachable):  |

2025-03-04T15:10:47.586Z: 2025-03-04T15:10:47Z INF |  https://mercy-passengers-ends-mit.trycloudflare.com                                       |
2025-03-04T15:10:47Z INF +--------------------------------------------------------------------------------------------+

2025-03-04T15:10:47.587Z: 2025-03-04T15:10:47Z INF Version 2024.8.2
2025-03-04T15:10:47Z INF GOOS: darwin, GOVersion: go1.22.2-devel-cf, GoArch: amd64

2025-03-04T15:10:47.587Z: 2025-03-04T15:10:47Z INF Settings: map[cred-file:/Users/rafael/.cloudflared/fake73c4b-1f17-5918-b1bf-6d8bcfe7cache.json credentials-file:/Users/rafael/.cloudflared/fake73c4b-1f17-5918-b1bf-6d8bcfe7cache.json ha-connections:1 no-autoupdate:true protocol:quic url:http://localhost:62136]

2025-03-04T15:10:47.588Z: 2025-03-04T15:10:47Z INF Generated Connector ID: 58ce6d2d-77df-39b5-gc3c-ee29c6441c69

2025-03-04T15:10:48.060Z: 2025-03-04T15:10:48Z WRN Your version 2024.8.2 is outdated. We recommend upgrading it to 2025.2.1

2025-03-04T15:10:48.082Z: Polling tunnel status for cloudflare (attempt 8): starting
2025-03-04T15:10:48.583Z: Polling tunnel status for cloudflare (attempt 9): starting
2025-03-04T15:10:49.082Z: Polling tunnel status for cloudflare (attempt 10): starting
2025-03-04T15:10:49.583Z: Polling tunnel status for cloudflare (attempt 11): starting
2025-03-04T15:10:50.084Z: Polling tunnel status for cloudflare (attempt 12): starting
2025-03-04T15:10:50.586Z: Polling tunnel status for cloudflare (attempt 13): starting
2025-03-04T15:10:51.086Z: Polling tunnel status for cloudflare (attempt 14): starting
2025-03-04T15:10:51.587Z: Polling tunnel status for cloudflare (attempt 15): starting
2025-03-04T15:10:52.088Z: Polling tunnel status for cloudflare (attempt 16): starting
2025-03-04T15:10:52.590Z: Polling tunnel status for cloudflare (attempt 17): starting
2025-03-04T15:10:53.091Z: Polling tunnel status for cloudflare (attempt 18): starting
2025-03-04T15:10:53.591Z: Polling tunnel status for cloudflare (attempt 19): starting
2025-03-04T15:10:54.093Z: Polling tunnel status for cloudflare (attempt 20): starting
2025-03-04T15:10:54.593Z: Polling tunnel status for cloudflare (attempt 21): starting
2025-03-04T15:10:55.094Z: Polling tunnel status for cloudflare (attempt 22): starting
2025-03-04T15:10:55.595Z: Polling tunnel status for cloudflare (attempt 23): starting
2025-03-04T15:10:56.096Z: Polling tunnel status for cloudflare (attempt 24): starting
2025-03-04T15:10:56.598Z: Polling tunnel status for cloudflare (attempt 25): starting
2025-03-04T15:10:57.099Z: Polling tunnel status for cloudflare (attempt 26): starting
2025-03-04T15:10:57.589Z: 2025-03-04T15:10:57Z ERR Failed to fetch features, default to disable error="lookup cfd-features.argotunnel.com on 25.205.255.77:55: dial udp 25.205.255.77:55: i/o timeout"

2025-03-04T15:10:57.600Z: Polling tunnel status for cloudflare (attempt 27): starting
2025-03-04T15:10:58.101Z: Polling tunnel status for cloudflare (attempt 28): starting
2025-03-04T15:10:58.602Z: Polling tunnel status for cloudflare (attempt 29): starting
2025-03-04T15:10:59.103Z: Polling tunnel status for cloudflare (attempt 30): starting
2025-03-04T15:10:59.603Z: Polling tunnel status for cloudflare (attempt 31): starting
2025-03-04T15:11:00.105Z: Polling tunnel status for cloudflare (attempt 32): starting
2025-03-04T15:11:00.606Z: Polling tunnel status for cloudflare (attempt 33): starting
2025-03-04T15:11:01.106Z: Polling tunnel status for cloudflare (attempt 34): starting
2025-03-04T15:11:01.608Z: Polling tunnel status for cloudflare (attempt 35): starting
2025-03-04T15:11:02.109Z: Polling tunnel status for cloudflare (attempt 36): starting
2025-03-04T15:11:02.610Z: Polling tunnel status for cloudflare (attempt 37): starting
2025-03-04T15:11:03.111Z: Polling tunnel status for cloudflare (attempt 38): starting
2025-03-04T15:11:03.612Z: Polling tunnel status for cloudflare (attempt 39): starting
2025-03-04T15:11:04.114Z: Polling tunnel status for cloudflare (attempt 40): starting
2025-03-04T15:11:04.615Z: Polling tunnel status for cloudflare (attempt 41): starting
2025-03-04T15:11:05.116Z: Polling tunnel status for cloudflare (attempt 42): starting
2025-03-04T15:11:05.616Z: Polling tunnel status for cloudflare (attempt 43): starting
2025-03-04T15:11:06.117Z: Polling tunnel status for cloudflare (attempt 44): starting
2025-03-04T15:11:06.618Z: Polling tunnel status for cloudflare (attempt 45): starting
2025-03-04T15:11:07.120Z: Polling tunnel status for cloudflare (attempt 46): starting
2025-03-04T15:11:07.608Z: 2025-03-04T15:11:07Z INF Initial protocol quic

2025-03-04T15:11:07.612Z: 2025-03-04T15:11:07Z INF ICMP proxy will use 10.0.0.216 as source for IPv4

2025-03-04T15:11:07.612Z: 2025-03-04T15:11:07Z INF ICMP proxy will use fe80::4:2287:1a0a:2c74 in zone en0 as source for IPv6

2025-03-04T15:11:07.613Z: 2025-03-04T15:11:07Z INF Created ICMP proxy listening on 10.0.0.216:0

2025-03-04T15:11:07.613Z: 2025-03-04T15:11:07Z INF Created ICMP proxy listening on [fe85::5:2285:1a0a:2c75%en0]:0

2025-03-04T15:11:07.620Z: Polling tunnel status for cloudflare (attempt 47): starting
2025-03-04T15:11:08.120Z: Polling tunnel status for cloudflare (attempt 48): starting
2025-03-04T15:11:08.621Z: Polling tunnel status for cloudflare (attempt 49): starting
2025-03-04T15:11:09.123Z: Polling tunnel status for cloudflare (attempt 50): starting
2025-03-04T15:11:09.623Z: Polling tunnel status for cloudflare (attempt 51): starting
2025-03-04T15:11:10.125Z: Polling tunnel status for cloudflare (attempt 52): starting
2025-03-04T15:11:10.626Z: Polling tunnel status for cloudflare (attempt 53): starting
2025-03-04T15:11:11.127Z: Polling tunnel status for cloudflare (attempt 54): starting
2025-03-04T15:11:11.628Z: Polling tunnel status for cloudflare (attempt 55): starting
2025-03-04T15:11:12.129Z: Polling tunnel status for cloudflare (attempt 56): starting
2025-03-04T15:11:12.631Z: Polling tunnel status for cloudflare (attempt 57): starting
2025-03-04T15:11:13.132Z: Polling tunnel status for cloudflare (attempt 58): starting
2025-03-04T15:11:13.633Z: Polling tunnel status for cloudflare (attempt 59): starting
2025-03-04T15:11:14.134Z: Polling tunnel status for cloudflare (attempt 60): starting
2025-03-04T15:11:14.635Z: Polling tunnel status for cloudflare (attempt 61): starting
2025-03-04T15:11:15.136Z: Polling tunnel status for cloudflare (attempt 62): starting
2025-03-04T15:11:15.637Z: Polling tunnel status for cloudflare (attempt 63): starting
2025-03-04T15:11:16.138Z: Polling tunnel status for cloudflare (attempt 64): starting
2025-03-04T15:11:16.639Z: Polling tunnel status for cloudflare (attempt 65): starting
2025-03-04T15:11:17.140Z: Polling tunnel status for cloudflare (attempt 66): starting
2025-03-04T15:11:17.640Z: Polling tunnel status for cloudflare (attempt 67): starting
2025-03-04T15:11:17.646Z: 2025-03-04T15:11:17Z INF Starting metrics server on 127.0.0.1:62145/metrics

2025-03-04T15:11:18.141Z: Polling tunnel status for cloudflare (attempt 68): starting
2025-03-04T15:11:18.641Z: Polling tunnel status for cloudflare (attempt 69): starting
2025-03-04T15:11:19.143Z: Polling tunnel status for cloudflare (attempt 70): starting
2025-03-04T15:11:19.644Z: Polling tunnel status for cloudflare (attempt 71): starting
2025-03-04T15:11:20.145Z: Polling tunnel status for cloudflare (attempt 72): starting
2025-03-04T15:11:20.646Z: Polling tunnel status for cloudflare (attempt 73): starting
2025-03-04T15:11:21.147Z: Polling tunnel status for cloudflare (attempt 74): starting
2025-03-04T15:11:21.649Z: Polling tunnel status for cloudflare (attempt 75): starting
2025-03-04T15:11:22.150Z: Polling tunnel status for cloudflare (attempt 76): starting
2025-03-04T15:11:22.651Z: Polling tunnel status for cloudflare (attempt 77): starting
2025-03-04T15:11:23.152Z: Polling tunnel status for cloudflare (attempt 78): starting
2025-03-04T15:11:23.532Z: Killing process 28164: /Users/rafaelcorreagomes/.nvm/versions/node/v20.18.3/lib/node_modules/@shopify/cli/bin/cloudflared tunnel --url http://localhost:62136 --no-autoupdate
2025-03-04T15:11:23.653Z: Polling tunnel status for cloudflare (attempt 79): error
╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                  │
│  Could not start Cloudflare tunnel: unknown error.                                                                               │
│                                                                                                                                  │
│  What to try:                                                                                                                    │
│    • Run the command again                                                                                                       │
│    • Add the flag `--tunnel-url {URL}` to use a custom tunnel URL                                                                │
│                                                                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Hi Rafael,

Did you resolve this issue?

Not yet @Liam-Shopify, I am still using Cloudflare tunnel to then initiate the app via Shopify CLI.

@Liam-Shopify @rafael

Facing the same issue, is this resolved?

What is the solution for it.

For timeouts and other errors initiating Cloudflare tunnels, I’d recommend reviewing Cloudflare guidance on firewall configuration, or utilizing alternate networking options for local development.

This solves my issue, my me share the claude summary

Problem: npm run dev failed because Cloudflare tunnel couldn’t resolve DNS queries through your router (192.168.1.1).

Root Cause: Your router’s DNS was timing out when trying to resolve Cloudflare domains like cfd-features.argotunnel.com.

Error:
ERR Failed to fetch features error=“lookup cfd-features.argotunnel.com on 192.168.1.1:53: dial udp 192.168.1.1:53: i/o timeout”


Fix Applied

Changed DNS from router (192.168.1.1) to Cloudflare DNS (1.1.1.1):

sudo networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

Verification:

  • DNS now points to 1.1.1.1 ✓
  • DNS queries resolve without timeouts ✓
  • Cloudflare tunnel can now connect properly ✓

Why This Works

Your router’s DNS was either:

  • Too slow/unreliable
  • Blocking certain Cloudflare domains
  • Misconfigured

Cloudflare DNS (1.1.1.1) bypasses your router entirely for DNS lookups. Faster, more reliable, no timeouts.


Result

npm run dev should now work without Cloudflare tunnel errors. The tunnel will connect and you can develop normally.

1 Like

It started working on its own, Ming. But I appreciate your efforts, Thank you so much