Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

[dev] return granular API error messages #1330

Closed
jahands opened this issue May 27, 2020 · 4 comments · Fixed by #1356
Closed

[dev] return granular API error messages #1330

jahands opened this issue May 27, 2020 · 4 comments · Fixed by #1356

Comments

@jahands
Copy link
Contributor

jahands commented May 27, 2020

🐛 Bug Report

Wrangler Dev command won't work if Cloudflare API is down, is there a technical reason to require something from the Cloudflare API for testing locally?

Environment

  • operating system:
    WSL1 on Windows 10
  • output of rustc -V:
    Not installed
  • output of node -v:
    v8.10.0
  • output of wrangler -V:
    wrangler 1.9.0-rc.1
  • contents of wrangler.toml
name = "workers-multiapp-example"
type = "webpack"
account_id = "f9b1e1e2cf50cca79a58e395b6084239"
workers_dev = true
route = ""
zone_id = "93f68d5e5674aaeab0d492c8fbc31fee"
webpack_config = "webpack.config.js"
kv-namespaces = [
         { binding = "MY_KV", id = "e29b263ab50e42ce9b637fa8370175e8" }
]

Steps to reproduce

Run wrangler dev when the API is down

What did you expect to see?

Local environment running worker

What did you see instead?

Error: Could not upload your script. Check your internet connection or https://www.cloudflarestatus.com/ for rare incidents impacting the Cloudflare Workers API.

@jahands
Copy link
Contributor Author

jahands commented May 27, 2020

Upon further investigation, it turns out it's not that the API is down (although it was when I filed this issue according the the status page), but that the KV namespace doesn't exist.
Since I tried running wrangler dev before running wrangler publish, I never saw this error message:
image

Perhaps wrangler dev should output API errors similar to wrangler publish?

@EverlastingBugstopper
Copy link
Contributor

wrangler dev requires an internet connection, and this is documented and not likely to change.

As for the API error messages, we should definitely make those show up when running wrangler dev! That being said, I think they should be showing up, and you're running an outdated version of wrangler. Could you try updating and see if the problem persists?

@jahands
Copy link
Contributor Author

jahands commented May 27, 2020

Good catch! Updated to:
wrangler 1.9.2

Got a new error when using a bad KV Namespace:

Error: HTTP status client error (400 Bad Request) for url (https://api.cloudflare.com/client/v4/accounts/f9b1e1e2cf50cca79a58e395b6084239/workers/scripts/workers-multiapp-example/preview)

I think it would be good to add the actual error returned from the API for this command.
Obviously using a non-existent namespace is a silly error, but I'm sure there are other errors that could happen that aren't as obvious.

@EverlastingBugstopper
Copy link
Contributor

ok - this is great info! thanks @jahands 😄

@EverlastingBugstopper EverlastingBugstopper changed the title Wrangler Dev requires Cloudflare API [dev] return granular API error messages May 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants