Skip to content

[Bug]: shopify app dev doesn't work well with custom Cloudflare tunnels #5791

@vfonic

Description

@vfonic

I have wasted several days on this issue. I haven't seen a single sentence in Shopify documentation mentioning this.

I use so-called cloudflare locally-managed tunnels extensively.
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/create-local-tunnel/

It allows me to have infinite permanent tunnels.
So I can have, for example: my-custom-shopify-app-with-function.example.com

And then I can, for example, have a webhook registered to that domain. I don't need to recreate/update webhooks every time I start a server.
I also have:

[build]
automatically_update_urls_on_dev = false

...because I didn't need it. Or at least I thought I don't need it.

However, this causes an issue deep within Shopify CLI, where Shopify CLI somewhere relies on cloudflare free tunnel ("TryCloudflare" aka "Quick Tunnel"). However, cloudflare quick tunnels don't work well with cloudflare local tunnels.
This wasn't an issue for me. Until I tried to run Shopify function locally.

https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/#use-trycloudflare

TryCloudflare quick tunnels are currently not supported if a config.yaml configuration file is present in the .cloudflared directory. It may be necessary to rename that file temporarily to use the feature.

I've spent several days trying to debug this Shopify CLI issue. Yes, it's a Cloudflare issue, but it's also Shopify CLI issue.

The only way to "fix" this is by doing:

mv ~/.cloudflared/config.yml ~/.cloudflared/config.yml2

And setting:

[build]
automatically_update_urls_on_dev = true

The better fix would be if Shopify CLI would try to be less smart and, instead of hiding many of the underlying settings/config, it would expose it, with sensible defaults.

Some other examples where Shopify CLI tries to be too smart and ruins the experience (potential making changes to the store(s) for the wrong client/merchant):

  • Shopify CLI stores and hides away the current store
  • Shopify CLI stores and hides away the current config app/extension/etc. TOML (shopify app dev should always assume the default config, for example, shopify.app.toml, and allow user to override this with --config - it does this, but because it's reading it from its internal storage, sometimes this is still broken even when --config is specified, without --config it doesn't use default, it uses "remembered" file. This is wrong, IMO.)

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Extension, Function, App

Expected behavior

shopify app dev works with Preview and local function testing

Actual behavior

The local function testing fails silently.

Verbose output

https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/#use-trycloudflare

Verbose output

There is no output, when you start local server with shopify app dev, and have, for example delivery function, the delivery function never reaches your local server.

Reproduction steps

  1. You have to have a cloudflare account and a domain in cloudflare
  2. Use cloudflare to create a subdomain tunnel for your domain
  3. Run shopify app dev
  4. Go to checkout to trigger Shopify Function call

Operating System

macOS 15.4.1

Shopify CLI version (shopify --version)

3.77.1

Shell

zsh

Node version (run node -v if you're not sure)

v22.12.0

What language and version are you using in your application?

ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [arm64-darwin24]

Metadata

Metadata

Assignees

Labels

Type: BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions