Cloudflare wrangler tail not connecting to remote server

I have deployed my worker successfully and able to access it. However, when I run wrangler tailin order to debug my prod traffic it just refuses to connect. Here is the message

:peacock: Setting up log streaming from Worker script “cloudflare-worker”. Using ports 8080 and 8081.
This may take a few seconds…

Any help in this regard is highly appreciated.

1 Like

Do you possibly have something running on port 8080 or 8081 already? Try to pass -p 0 and see if it connects.

(By the way, fastest way to get support for Worker related issues is Discord - Cloudflare Workers)

1 Like

Thank you for the reply. I cross verified and nothing is running on those ports

Also passing -p 0 did not help

1 Like

Is there any prerequisite for this to work like configuring a tunnel?

1 Like

I am also seeing this issue along with a few others on my team. Can you confirm your cloudflared version?

1 Like

You can see the verbose output by using the --verbose flag. I would also recommend checking if you are using environments to set the -e flag according to the environment you are attempting to listen to.

For example if you have a staging env configured in your wrangler.toml and want to get the verbose logging from Cloudflared (this will also give you version info) you can do the following:

wrangler tail --verbose -e staging

You can directly find versions for both wrangler and cloudflared as follows:

Cloudflared

$ cloudflared --version
cloudflared version 2021.7.0 (built 2021-07-12-1111 UTC)

Note that 2021.7.4 is actually the latest cloudflared version right now (update: tail was indeed broken in 2021.7.3)
Updating: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation#updating-cloudflared

Wrangler

$ wrangler --version
wrangler 1.18.0

Updating: https://developers.cloudflare.com/workers/cli-wrangler/install-update#update

1 Like

I have the exact same versions and no joy on my end. This was working yesterday. A few of my team members are having this issue so this isn’t an issue on my side.

1 Like

This is what I have for output when using verbose:

âžś  megaleocdn-play-mars_com git:(master) âś— wrangler tail --verbose | jq
🦚  Setting up log streaming from Worker script "wmc_worker_megaleocdn-play-mars_com". Using ports 8080 and 8081.
This may take a few seconds...
2021-07-28T00:18:55Z INF Requesting new Quick Tunnel...
2021-07-28T00:18:56Z INF +----------------------------------------------------+
2021-07-28T00:18:56Z INF |  Your Quick Tunnel has been created! Visit it at:  |
2021-07-28T00:18:56Z INF |  responses-impose-cables-compaq.trycloudflare.com  |
2021-07-28T00:18:56Z INF +----------------------------------------------------+
2021-07-28T00:18:56Z INF Version 2021.7.3
2021-07-28T00:18:56Z INF GOOS: darwin, GOVersion: go1.16.5, GoArch: amd64
2021-07-28T00:18:56Z INF Settings: map[metrics:localhost:8081 url:localhost:8080]
2021-07-28T00:18:56Z INF Generated Connector ID: dc252ae0-0c2b-413f-ac04-b6010a48a694
2021-07-28T00:18:56Z INF Autoupdate frequency is set autoupdateFreq=86400000
2021-07-28T00:18:56Z INF Initial protocol http2
2021-07-28T00:18:56Z INF Starting metrics server on 127.0.0.1:8081/metrics
2021-07-28T00:18:57Z ERR Register tunnel error from server side error="Unauthorized: Record for tunnel not found" connIndex=0
2021-07-28T00:18:57Z INF Retrying connection in up to 2s seconds connIndex=0
2021-07-28T00:18:58Z ERR Register tunnel error from server side error="Unauthorized: Record for tunnel not found" connIndex=0
2021-07-28T00:18:58Z INF Retrying connection in up to 4s seconds connIndex=0
2021-07-28T00:19:01Z INF Connection a3cae23f-cfc8-4e02-84cd-9ddf27c6aab4 registered connIndex=0 location=SEA
2021-07-28T00:19:02Z INF Connection 6c01a586-fe20-4263-82b6-a4e33ce11b05 registered connIndex=1 location=MSP
2021-07-28T00:19:03Z INF Connection f99c2de9-9f10-4438-ade0-25d19a0f5394 registered connIndex=2 location=SEA
2021-07-28T00:19:04Z INF Connection 3af9786e-b0d2-4b5f-b03d-19a396cded7b registered connIndex=3 location=MSP
1 Like

We have identified the issue with wrangler tail stopping to work with the latest cloudflared. We will be releasing a new cloudflared today that addresses the issue.

Thank you. Once released, please let us know the version number

Cloudflared 2021.7.4 was released and fixes the problem.

Following is the new error. Am i missing anything. Please suggest

2021-07-28T13:33:30Z ERR error=“Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:8080: connect: connection refused” cfRay=675e7acb19a91d3d-MRS originService=http://localhost:8080

2021-07-28T13:33:31Z ERR error=“Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:8080: connect: connection refused” cfRay=675e7acd8e981d3d-MRS originService=http://localhost:8080

2021-07-28T13:33:31Z ERR error=“Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:8080: connect: connection refused” cfRay=675e7acd8e9a1d3d-MRS originService=http://localhost:8080

2021-07-28T13:33:31Z ERR error=“Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:8080: connect: connection refused” cfRay=675e7acf69fb1d3d-MRS originService=http://localhost:8080

@girish my understanding is that wrangler tail opens a listener on port 8080 and then exposes that via cloudflared tunnel --url localhost:8080

In your case it seems like the tunnel is ok but the listener on port 8080 is not. You can probably check that with nc -v localhost 8080 (in my case it works when I have wrangler tail running).

I wouldn’t know why that listener is not available in your case; someone from the wrangler team would have to chime in.
You can also try to debug wrangler itself since it is open source: GitHub - cloudflare/wrangler: 🤠 wrangle your cloudflare workers

I’ve been able to confirm the 2021.07.04 works with wrangler 1.18.0. Thanks for the quick turnaround!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.