wrangler-legacy
wrangler-legacy copied to clipboard
[wrangler dev] HTTP status client error (400 Bad Request)
🐛 Bug Report
Environment
- operating system:
Darwin xxxxx 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
- output of
rustc -V
: Not available - output of
node -v
:v15.3.0
- output of
wrangler -V
:wrangler 1.12.2
- contents of
wrangler.toml
:
type = "javascript"
account_id = "78ab5493f4bafb4b7b027542995bb87d"
workers_dev = false
route = "httpbin.chriswang.me/anything/wrangler"
zone_id = "2a0086b5c6e89ce13797f1af8c8fa88a"
Steps to reproduce
Run wrangler dev
What did you expect to see?
What's described in the blog post
What did you see instead?
$ wrangler dev
Error: HTTP status client error (400 Bad Request) for url (https://chriswang.me/cdn-cgi/workers/preview/?s0=AfHYCyYtW01NMCmfbyLEEQ__pEX_5IXQjlCWo5pLoB06J0hYK8Mim0aocaUyLAPOOVlAQtHsT8yJwMh7B-FJ2L8obFpEKOXk3hTtfkZH53CmGv-OhnS8tFsS_d7PUNRhOgFaS0i4vzu6yiD1AJ9NUf31Aa_jQbq_7WRgSYwYroYDozTal-tF4ncVKRH4Do63KZrtq8lr9H2yLXgqvoBtqnOWpEb_envUse9PdDNQnr-DtWFXC2OUnm4_6biNLUtZP-rYbGXJoHICixMg_v-SLJs)
In contrast, wrangler preview
works as expected.
$ wrangler preview
💁 Opened a link in your default browser: https://cloudflareworkers.com/?hide_editor#1d64ed6f85411b047b005ac33f8edc74:https://example.com/
👷 Your Worker responded with: Hello worker!
The issue persists on the latest verison.
wrangler -V
👷 ✨ wrangler 1.12.3
I was able to work around this by deleting ~/.wrangler/config
Thanks. I just tried. Unfortunately, deleting ~/.wrangler/config
did not help with my case.
I faced the exact same problem after adding my root domain to Cloudflare Pages as custom domain. Deleting ~/.wrangler/config
did not fix the problem.
I faced this issue and it ended up being user error... The account id I had in my wrangler.toml file in my project was wrong. Might not be in your case but worth double checking the low hanging fruit IMO.
Same bug here. I cannot debug it anymore. Any solutions ?
OK, I got a solution. The command wrangler dev --host=localhost
works.
Same issue here using localhost works but that doesn't let me use the KV-store so not really an option
version: wrangler 1.19.0
wrangler dev --verbose
does not give any additional info
Fixed: I didn't specify any environment and so a variable was undefined in my script. Error reporting could be improved
Had the same issue. Spent hours & hours debugging and re-doing login etc when in practice this line broke it in a file where it's used exactly the same in another
const DataAPI = require('./data');
I had an error in my secret, it was not parsing correctly as JSON.
Ironically, can't be detected by wrangler build
, only found it when trying wrangler publish
, and wrangler dev
fails with the HTTP error...
Also note:
wrangler dev --host=localhost
does not use authentication, so things like secrets and KV not working.
Same issue here
wrangler 1.19.0
Changing type = javascript
to type = webpack
in wrangler.toml
"fixed" this issue for me. Apparently, it was somehow caused by using module syntax import / export
for local files in my case.
I have the same issue. Even on the latest wrangler (1.19.3
), the command wrangler dev
fails with the same error Error: HTTP status client error (400 Bad Request)
when specifying a route
in wrangler.toml
. Without a route and with workers_dev = true
it works fine. This may be a problem in wrangler's interaction with custom domains.
after reading this whole thread, this was caused by a compiler error for me. wrangler needs some better error reporting
Same here, circular requires for example broke it without any trace for me
In my case, the worker route is configured at a subdomain (jsonp.afeld.me), while my second-level domain (afeld.me) is configured to be DNS only
. wrangler dev
tries to access access https://afeld.me/cdn-cgi/workers/preview/?...
, which then gives a 404 from my [second-level domain] hosting provider. Two workarounds:
-
Running
wrangler dev --unauthenticated
-
Re-enabling
*.wrangler.dev
and moving myroute
configuration in thewrangler.toml
under an environment, like so:workers_dev = true [env.production] route = "jsonp.afeld.me/*"
👋 Thanks for reporting this issue! Wrangler v1 is now deprecated and support is only being provided for critical updates or security concerns. As such, we are closing this issue.
New versions of Wrangler are maintained in the workers-sdk repo. If you are running into a similar issue with wrangler v2, please report it in the workers-sdk repo. For more info about wrangler v1 deprecation, please check out our blog post.