laravel / valet

A more enjoyable local development experience for Mac.
https://laravel.com/docs/valet
MIT License
2.51k stars 695 forks source link

Ngrok not finding authtoken #1432

Closed whoacowboy closed 1 year ago

whoacowboy commented 1 year ago

Description

When I set the auth token ngrok does not recognize it.

valet set-ngrok-token SUPERSECRTETAUTHTOKEN
Authtoken saved to configuration file: /Users/james/.ngrok2/ngrok.yml

When I run

valet share -hostname=sub.example.com -region=us;

I get the error

Please sign up for a free ngrok account and then run valet set-ngrok-token {yourTokenHere}.

Steps To Reproduce

I did a fresh update, install and restart of valet. Restarted my computer a couple of times and the issue persisted.

I install of ngrok from the ngrok.com and not brew but the ngrok install and the brew install land them in the same directory which is the same as brew --prefix

I set the authtoken with the ngrok command as well as the valet command.

ngrok config add-authtoken SUPERSECRTETAUTHTOKEN

So it could be my bad.

Diagnosis

The only thing that makes me think it might be an issue with valet and not my setup is this. When I comment out the token check in ~/.composer/vendor/laravel/valet/valet works fine.

        BREW_PREFIX=$(brew --prefix)
        $($BREW_PREFIX/bin/ngrok config check >/dev/null 2>&1)

#        if [[ $? -ne 0 ]]; then
#            echo "Please sign up for a free ngrok account and then run valet set-ngrok-token {yourTokenHere}."
#            exit
#        fi
github-actions[bot] commented 1 year ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

drbyte commented 1 year ago

Do you get any errors when running ngrok config check directly?

If it gives you an error like the following, then run ngrok config upgrade:

ERROR:  Error reading configuration file '/Users/username/.ngrok2/ngrok.yml': `version` property is required.
ERROR:
ERROR:  If you're upgrading from an older version of ngrok, you can run:
ERROR:
ERROR:      ngrok config upgrade
ERROR:
ERROR:  to upgrade to the new format and add the version number.

If it also gives you the following message about relocating, then you could optionally consider also running ngrok config upgrade --relocate:

Run this command with the --relocate flag to move your config file to the default location

After that, does the authtoken error persist?

whoacowboy commented 1 year ago

I ended up uninstalling and reinstalling most everything, Ngrok, valet and the problem resolved.