I'm not 100% sure this is the answer to your issue; but this might be the solution:
Helge has written an article here about using ngrok with Craft CMS (which I'd recommend looking over if you haven't already). In particular, he mentions he has the following lines in his Craft config particularly for logging into the CP over ngrok:
// Logging in to the CP ...
I don’t know if the following will help with Valet, but I ran into the same problem today with my local Homebrew dev server. Despite having /usr/local/bin in my PATH and mysqldump working just fine on the command line the backup task would fail.
Checking the PHP info page revealed that Apache was running with a PATH setting of /usr/bin:/bin:/usr/sbin:/sbin. ...
I believe we were conversing via Medium yesterday on this issue.
Regarding your question, I know for a fact your PATH reference is incorrect. The path to mysqldump is never ~/.local/bin/mysqldump; mine is located at /usr/local/bin/mysqldump (I'm using MariaDB).
BUT since you said on Medium that you're using MySQL (instead of MariaDB or another database ...
I forgot to add that i use https://github.com/nystudio107/craft-multi-environment as a flexible multi-environment config for Craft CMS.
I managed to fix the issue setting two variables to the linked valet url in the public/index.php:
$_SERVER['PHP_SELF'] = 'valeturl.dev';
$_SERVER['SCRIPT_NAME'] = 'valeturl.dev';
now all the updates etc work as expected.
The issue seemed to stem from the fact that Caddy serves up PHP with fastcgi, instead of Apache or Nginx, and something to do with http requests used to start the task. AJAX requests (what my other functioning task plugins were using to kickoff) were unaffected.
Following a suggestion found here: https://stackoverflow.com/questions/11758334/fastcgi-finish-...