wrangler-legacy
wrangler-legacy copied to clipboard
wrangler login just get stuck `Waiting for API token...`
🐛 Bug Report
I found this closed issue https://github.com/cloudflare/wrangler/issues/1514 has a number of people reporting this same issue with the tool hanging, but looking at that original issue which was closed in October it looks like was for a different problem.
Environment
- operating system:
Ubuntu 20.04.1 LTS
- output of
rustc -V
:rustc 1.47.0 (18bf6b4f0 2020-10-07)
- output of
node -v
:v10.19.0
- output of
wrangler -V
:wrangler 1.12.3
- contents of
wrangler.toml
name = "test"
type = "javascript"
account_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
workers_dev = true
route = ""
zone_id = ""
(Simply created via wrangler generate test
)
Steps to reproduce
run wrangler login
What did you expect to see?
After authorizing Cloudflare via the opened web browser, after the token is created, I expected wrangler login
to continue.
What did you see instead?
I do see the browser open (Firefox) and I'm able to authorize the creation of a new token which does happen successfully but the wrangler login
tool remains stuck forever with Waiting for API token...
Since it was suggested in #1514 that it might make a difference to delete existing tokens first I also tried deleting all tokens but that didn't seem to make a difference for me.
This happens to me too. Can use wrangle login
cause it gets stucked. :/
I am experiencing the same issue. I wonder if it has to do with the fact that I have two cloudflare accounts. When I do wrangler whoami
, I see the old account that I do not want to use. It could be useful to have a wrangler logout
command which other CLI's (like Firease-CLI) have. At first I thought this may have been an issue with the api token callback back to VSCode, but the error is also happening in Terminal (on MacOS).
I have the same issue, I have one cloudflare account. I'm using Ubuntu with Firefox as default browser and containers extension.
I was able to get the login and auth callback from the browser to work just now. Not sure if this works for anyone else, but I ran the command wrangler config --api-key
, which is the command to set the global api key, and which is not recommended. I cancelled out from that command and then ran wrangler login
again, and it authenticated successfully. Could have been chance, but maybe that might work for someone else as the command may have cleared something from the config.
Same issue here too. Chrome 87 on Mac 10.15.5
I just encountered the same issue, weirdly enough @nolandubeau's workaround worked for me too (thanks ❤️ )
I was able to get the login and auth callback from the browser to work just now. Not sure if this works for anyone else, but I ran the command
wrangler config --api-key
, which is the command to set the global api key, and which is not recommended. I cancelled out from that command and then ranwrangler login
again, and it authenticated successfully. Could have been chance, but maybe that might work for someone else as the command may have cleared something from the config.
It works! thanks
I ran into the same issue: Ubuntu 20.04 Chrome 88.0.4324.96 wrangler 1.13.0 node v14.4.0
Thanks @nolandubeau , your workaround fixed the issue!
Same issue on macos
Sometimes if you already logged in and tried to log in again, you'll get stuck. In any case, that was what happen to me with wrangler 1.13.0
in ubuntu 19
.
I got stuck with the same message Waiting for API token...
and tried many methods suggsested from the net. Nothing worked. It turned out I already logged in last time.
To find out whether you already logged in, do
wrangler whoami
If your account name and id show up, you are good to go.
Same issue for freshly installed wrangler (using Cargo). Version 1.13.0. I'm using Archlinux (Kernel version 5.10.11)
Same issue. I fixed it by fill API token manually.
- Use
wrangler login
to open login link. - Press F12, then switch it to network tab.
- Press "Authorize Wrangler", then wait it success.
- Check the lastest request, find a request like
https://dash.cloudflare.com/api/v4/user/tokens/SOME_HEX_STRING_HERE/value
, then find your API token in the response. - Run command
wrangler config
, paste the API token into it and press Enter, then you will get "Successfully configured. You can find your configuration file at: ..."
Hey folks, are y'all reaching a page that looks like:
and after clicking "Authorize Wrangler", wrangler login is still stuck?
If you aren't reaching this page, try logging in and opening the link that wrangler login
prints to your console.
If you are clicking "Authorize Wrangler" and wrangler login
is still getting stuck, I'd like to get more information to reproduce this problem.
Hi @xortive , I reach this page, but after clicking the authorize button, the cli is still stuck. Happens consistently on all worker projects that I have, workers and worker-sites. Here's one toml for example
name = "form-data-app"
type = "webpack"
account_id = "c4axxxxxxxxxx710"
workers_dev = false
route = "https://app.form-data.com/*"
zone_id = "f6bxxxxxxxxxxxxxxxxe15"
[site]
bucket = "./dist/pwa"
entry-point = "workers-site"
Happens on Chrome 88 on Mac 10.15.5, but Also happened on previous versions of both mac and chrome. Let me know what other details do you need.
Hey folks, are y'all reaching a page that looks like:
and after clicking "Authorize Wrangler", wrangler login is still stuck?
If you aren't reaching this page, try logging in and opening the link that
wrangler login
prints to your console.If you are clicking "Authorize Wrangler" and
wrangler login
is still getting stuck, I'd like to get more information to reproduce this problem.
Yes, after clicking the wrangler login it is stuck. Let me know what info do you need. I can share.
After clicking it got stuck, I was able to fix it by manually setting it a long time ago. On macos with homebrew.
Have same issue,
After calling wrangler config
added token manually.
Calling wrangler whoami
outputs correct email and token.
But when runing wrangler dev
- shows You have not provided your Cloudflare credentials.
Anyone had same issue?
Note: temporary downgraded to 10.0.3
Managed to login , by wrangler login ->authorize selecting roll on the API Token page for wrangler copy token wrangler config ->paste token
whoami gives correct output then:
wrangler dev gives:
Error: wrangler.toml not found; run wrangler init
to create one.
running wrangler init:
you can copy your account_id below
"account details"
Error: field account_id
is required to deploy to workers.dev
edited wrangler.toml with account id.
└─$ wrangler dev 130 ⨯
thread 'Result::unwrap()
on an Err
value: Io(Os { code: 28, kind: Other, message: "No space left on device" })', src/watch/mod.rs:39:22
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
However I managed to create a test worker with wrangler generate. A reboot got rid of the error message.
Extra info - may be browser dependent? I attempted three times in Safari, both times I got stuck on "waiting for API token..." switched my default browser to Firefox, tried again, and it worked fine.
May be due to other external factors and just so happened that it worked 1 / 4 times, but might be an avenue worth investigating.
ran wrangler login
in integrated terminal on VScode, macOS Big Sur, wrangler 1.11.0.
Was trying this from VSCode Integrated Terminal to Chrome and it was stuck for me. I tried it in OSX Terminal to Chrome and then it worked as expected
same issue here
Same issue. I fixed it by fill API token manually.
1. Use `wrangler login` to open login link. 2. Press F12, then switch it to network tab. 3. Press "Authorize Wrangler", then wait it success. 4. Check the lastest request, find a request like `https://dash.cloudflare.com/api/v4/user/tokens/SOME_HEX_STRING_HERE/value` , then find your API token in the response. 5. Run command `wrangler config`, paste the API token into it and press Enter, then you will get "Successfully configured. You can find your configuration file at: ..."
Thanks, this worked
After the token was created I just aborted the login command. Then find the token here. Next to the token is a button with 3 dots. Click and select 'roll'.
Now you get a new token that you can use with wrangler config
From my side, it worked once I created the following folder.
mkdir -p ~/.wrangler/config/
Same issue using VSCode and Brave. Kind of frustrating when you're onboarding ;)
https://github.com/cloudflare/wrangler/issues/1703#issuecomment-817285470 does the trick
Same issue on macos 11.2.3 with brave.
Hey all - we're currently looking into this issue & have some questions if anyone can share details on the following:
- which version of wrangler are you running?
wrangler --version
- when
wrangler login
remained stuck waiting on the token, was this your first time logging in via CLI? - if you got the "Wrangler is now authorized with a new API Token" screen but still observed the CLI to hang, can you check if you ended up getting anything written to
~/.wrangler/config/default.toml
or the equivalent path on your OS?
Additionally: if you can retry the login flow with logging enabled, and share the output (removing any tokens if they are visible), please do by running:
RUST_LOG=debug wrangler login
Thank you -- lots of weird little edge cases here, so all details are really helpful.
@timhaak, re:
From my side, it worked once I created the following folder. mkdir -p ~/.wrangler/config/
Did the CLI show any permission error indicating that it couldn't write to disk or create any files?
And to confirm, you created that directory, and then re-executed wrangler login
, which worked as expected?
Hi @nilslice!
Just because you wanted me to test, wrangler doesn't seem to get stuck as described in #1883. Although, the token got replaced, so it invalidated one environment when logging into another.
- 1.16.1
- Yes
@Yrlish - thank you!
Just because you wanted me to test, wrangler doesn't seem to get stuck as described in #1883.
😄 haha that seems to be the way these things work!
So both devices are now able to use wrangler login
? The device change should invalidate the other, but it shouldn't hang when trying to revalidate on the second device. Are you able to get the second device to auth as expected, or does it still hang?