Solved

Cloudflare Tunnel failed to request a quick tunnel

Timotej1
Shopify Partner
1 0 1

I am trying to create a Shopify app and I am encountering an error when entering npm run dev command. The error message states that the Cloudflare Tunnel failed to request a quick tunnel due to an existing connection forcibly closed by the remote host. I'm relatively new to this, so this might be an easy setup issue, however I was not able to figure it out.

 

Thank you in advance for your help.


LOG:

 

 

 

npm run dev
 
> test-app@1.0.0 dev
> shopify app dev
 
 
To run this command, log in to Shopify Partners.
:point_right: Press any key to open the login page on your browser
✔ Logged in.
 
Looks like this is the first time you're running dev for this project.
Configure your preferences by answering a few questions.
 
?  App name:
✔  TestApp
 
✔ Using your default dev store (TestAppdevstore) to preview your project.
:white_check_mark: Success! Converted TestAppdevstore.myshopify.com to a Test store.
 
Error: Command failed with exit code 1: C:/Users/username/Documents/Programmering/Shopify/test-app/node_modules/@shopify/plugin-cloudflare/bin/cloudflared.exe tunnel --url http://localhost:55864 --no-autoupdate 
2023-04-10T11:49:58Z INF Thank you for trying Cloudflare Tunnel. Doing so, without a Cloudflare account, is a quick way to experiment and try it out. However, be aware that these account-less Tunnels have no uptime guarantee. If you intend to use Tunnels in production you should use a pre-created named tunnel by following: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
2023-04-10T11:49:58Z INF Requesting new quick Tunnel on trycloudflare.com...
failed to request quick Tunnel: Post "https://api.trycloudflare.com/tunnel": read tcp 192.168.0.91:55871->172.16.16.16:443: wsarecv: An existing connection was forcibly closed by the remote host.
    at makeError (file:///C:/Users/username/Documents/Programmering/Shopify/test-app/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///C:/Users/username/Documents/Programmering/Shopify/test-app/node_modules/execa/index.js:119:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exec (file:///C:/Users/username/Documents/Programmering/Shopify/test-app/node_modules/@shopify/cli-kit/dist/public/node/system.js:54:9)
PS C:\Users\username\Documents\Programmering\Shopify\test-app> 

 

 

Accepted Solution (1)

ejprismfly
Shopify Partner
2 1 4

This is an accepted solution.

adding --tunnel ngrok fixed the problem, looks like the default tunneling service will now be cloudflared.

npm run dev -- --reset --tunnel ngrok

 

View solution in original post

Replies 14 (14)

ejprismfly
Shopify Partner
2 1 4

Experiencing it right now also

 

Timed out while creating a cloudflare tunnel: failed to request quick Tunnel

 

ejprismfly
Shopify Partner
2 1 4

This is an accepted solution.

adding --tunnel ngrok fixed the problem, looks like the default tunneling service will now be cloudflared.

npm run dev -- --reset --tunnel ngrok

 

Samruddhi
Shopify Partner
7 0 4

Hey 

I'm having the same problem, and my default cloudfare tunnelling is not resetting.
I tried the same "npm run dev -- --reset ngrok" , tried with ngrok url as well 

Samruddhi_1-1686047037744.png


 

ShopifyDevSup
Shopify Staff
1358 226 475

Hey @Samruddhi1 - this does seem odd, thanks for getting in touch. My team doesn't directly support the CLI, but I would recommend reaching out in the CLI's Github repo and opening an issue. I can't guarantee anything specifically, but opening up an issue and reporting the error there will get you in direct touch with the CLI developers and they may be able to help you out further. 

This is usually the best place to get help for any of our development tools or specific API libraries for the programming languages we directly support (Ruby, Node.js, PHP). 

Hope this helps. 

 

Al | Shopify Developer Support 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

darpan7th
Shopify Partner
1 0 0

worked for me thanks

raultoks-peppy
Shopify Partner
10 1 4

raultokspeppy_0-1696811590371.png

which version of the shopify cli would you be using. I am using 3.49.2

ShopifyDevSup
Shopify Staff
1358 226 475

Hey @ejprismfly 

Glad you got this working. 

If you run into any other errors while working with the Shopify CLI I would recommend checking in their Github Repo's Issues as well.

 

All the best

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Samruddhi
Shopify Partner
7 0 4

Hey, 

I'm having the same problem, and my default cloudfare tunnelling is not resetting.
I tried the same "npm run dev -- --reset ngrok" , tried with ngrok url as well 

Samruddhi_0-1686046949174.png


Could you please help me ?





den232
Shopify Partner
187 8 52

And again for me. failed to request quick Tunnel ... 

Worked yesterday, today it's crap.

 

Is it possible to use my own ngrok tunnel, skipping the flaky cloudflared?

round
Shopify Partner
5 0 1

npm run dev -- --tunnel-url https://some-url-3000.inc1.devtunnels.ms:3000/. It's working as expected.

jamesdix
Shopify Partner
4 0 4

I've been experiencing this tunnel issue over the last 24 hours, and using my own ngrok tunnel works.

In a new terminal tab run

ngrok http 3000


and then in the other terminal tab, from within the repo of your app run shopify app dev --reset --tunnel-url {ngrok https url}:3000

For instance, mine was: 

shopify app dev --reset --tunnel-url https://5127-46-149-103-112.ngrok-free.app:3000



hope that helps!

den232
Shopify Partner
187 8 52

Thank you, Jamesdix and round. Did that and it worked. Happy to bid adieu to the often-dead (but free) cloudflared. Jb

ankeshgupta
Shopify Partner
41 9 4

I have also faced the same kind of issue and resolved after clearing the DNS Cache using this command ipconfig /flushdns

╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Could not start Cloudflare tunnel: failed to unmarshal quick Tunnel:        │
│  invalid character '<' looking for beginning of value                        │
│                                                                              │
│                                                                              │
│  What to try:                                                                │
│    • Run the command again                                                   │
│    • Add the flag `--tunnel-url {URL}` to use a custom tunnel URL

 

Ankesh Gupta | Shopify Theme Developer
- Was my reply helpful? Click Like or Accept solution to let me know!
Want a skilled Shopify developer? Reach out at
ankeshgupta0205@gmail.com
den232
Shopify Partner
187 8 52

Or cough up $20/mo for ngrok and say goodbye and good riddance to the flaky cloudflare. That’s what I did months ago and never looked back. Cheers jb