question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛 BUG: with a custom route defined, `wrangler dev` tries to request data from the wrong host when starting up

See original GitHub issue

What version of Wrangler are you using?

2.0.3

What operating system are you using?

Mac

Describe the Bug

  1. I have a route defined like so:
routes = [{ pattern = "*foo.bar.com/*", zone_name = "bar.com" }]
  1. I start up wrangler dev
  2. Wrangler tries to request bar.com/cdn-cgi/workers/preview, not foo.bar.com
  3. Wrangler dies with ✘ [ERROR] Error on remote worker: SyntaxError: Unexpected token < in JSON at position 0 as it blindly tries to parse the incoming HTML from the wrong host as JSON.

Notes:

  • wrangler dev works if I remove the route
  • wrangler dev --local works
  • foo.bar.com is routed to 192.0.2.1 in the DNS settings, and proxied through CF
  • bar.com is routed to another public IP, and not proxied

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
threepointonecommented, May 12, 2022

A workaround for now is to add this to your wrangler.toml:

[dev]
host = "foo.bar.com"
0reactions
threepointonecommented, Jul 5, 2022

Closing this issue, we released 2.0.16 that includes the probable fix, but happy to reopen if this issue persists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dev needs to support for custom routes #1529 - GitHub
Since Wrangler dev is now using a proxy through custom routes we need the ability to identify custom routes. Right now it requires...
Read more >
Deprecations · Cloudflare Workers docs
Deprecations. This document describes the difference between Wrangler 1 and 2, specifically deprecations and breaking changes.
Read more >
ssl - CloudFlare workers fetch HTTPS works on workers.dev ...
The DNS works fine the URL is reachable, but when I try to hit https://foo.mydomain.com/myEndpoint CloudFlare's worker logs show that the fetch ...
Read more >
Wrangler | Noise
TypeScript makes it easy for developers to write code that doesn't crash, by catching type errors before your program runs. We want developers...
Read more >
Using the CLI - Miniflare
It lets you start a local HTTP server that serves requests using your worker. Tip. If you'd like to try out a zero-configuration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found