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

Regression: cannot start a local unauthenticated dev server without an account id in wrangler.toml #1525

Closed
0dinD opened this issue Aug 25, 2020 · 3 comments Β· Fixed by #2030
Closed
Labels
bug Something isn't working dev `wrangler dev`

Comments

@0dinD
Copy link

0dinD commented Aug 25, 2020

πŸ› Bug Report

Environment

  • operating system: Linux (Debian 10 Buster)
  • output of rustc -V: N/A
  • output of node -v: v14.8.0
  • output of wrangler -V: πŸ‘· ✨ wrangler 1.11.0
  • contents of wrangler.toml:
name = "test"
type = "javascript"
workers_dev = true

Steps to reproduce

  1. Create a valid worker
  2. Run wrangler dev

What did you expect to see?

πŸ’  Running preview without authentication.
πŸ’  watching "./"
πŸ‘‚  Listening on http://127.0.0.1:8787

What did you see instead?

Error: field `account_id` is required to deploy to workers.dev

Further comments

This is a regression from wrangler 1.10, where no account id was required in wrangler.toml. I don't think it should be required if you don't want to authenticate and just want to run the worker on your local machine for quick development and testing.

The dev command actually does work as expected if you supply an account id in wrangler.toml, but it doesn't even have to be valid as it's clearly not used when you don't authenticate. So the following is a workaround:

name = "test"
type = "javascript"
workers_dev = true
account_id = "not_a_valid_id"
@ashleymichal ashleymichal added bug Something isn't working dev `wrangler dev` labels Sep 11, 2020
@nataliescottdavidson
Copy link
Contributor

This is a documentation issue. wrangler dev runs on the edge, not your local machine. Calls to localhost:8787 are routed to a preview worker. So your prod workers will be unchanged, but it is a real worker on the edge. You need to be authenticated for that to work.

My understanding is that the old wrangler dev is now wrangler preview, you can run locally using that.

@0dinD
Copy link
Author

0dinD commented Oct 30, 2020

@nataliescottdavidson Thanks for clarifying! However, I don't agree with this statement:

...it is a real worker on the edge. You need to be authenticated for that to work.

Clearly, I don't need to be authenticated, because the dev command works just fine in wrangler 1.10. In wrangler 1.11, nothing has changed except for the fact that dev will produce an error if account_id is empty, which is what this issue is about. The account id is clearly not used for any sort of authentication since everything works the same in 1.11 as in 1.10 so long as you specify anything in account_id, such as account_id = "not_a_valid_id".

Now, I understand if you do need to authenticate in order to run the worker in a "production-like" environment, but if all I want to do is use the preview service I shouldn't have to authenticate. I don't want to use wrangler preview as it doesn't provide a local server to test against, something I find extremely useful.

On a related note, this message pops up every time I use wrangler dev
wrangler-dev
Even though it can be ignored, it's a bit annoying seeing as I'm fully aware that I'm not authenticated and want to continue that way. The worker is published from a CI pipeline, in case you're wondering where I'm authenticating.

To clarify: this issue is just about removing the arbitrary requirement of an account id when running wrangler dev unauthenticated (in preview mode). An alternative solution would be to add an option to specify preview mode for wrangler dev in wrangler.toml, such as preview = true, which could also remove the annoying warning message shown in my screenshot.

@jyn514
Copy link
Contributor

jyn514 commented Aug 27, 2021

This will be fixed by #2030.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working dev `wrangler dev`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants