nabeelio / phpvms

virtual airline management
http://www.phpvms.net
Other
170 stars 140 forks source link

cURL error 3 during update #707

Closed web541 closed 4 years ago

web541 commented 4 years ago

Describe the bug As reference on the forum thread here the /update is throwing a cURL 3 error for a number of users. I've done some investigation on it which I provide below.

Version 7.0.0-beta.3 7.0.0-beta.4 dev branch

To Reproduce Steps to reproduce the behavior:

  1. Go to Admin Panel -> Maintenance -> Update or /update route
  2. Click "Update"
  3. Error thrown
    GuzzleHttp\Exception\RequestException
    cURL error 3: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Expected behavior Update of phpVMS installation (as far as I'm aware)

Bit of investigation On all versions tested above the same error is thrown. On beta.4 the update fails to recognise that there is no update available as it should already be on the latest version. On dev, not sure if it's supposed to do the same as it's completely different and I assume the update is pulling off the master branch? The updater doesn't seem to like this line (UpdateModule -> UpdateController.php line 134). So I did some dumping and doing something like this:

        $version = $this->kvpRepo->get('latest_version_tag');
        $release = $this->updateManager->source('github')->getVersionAvailable();
        dd($release);
        $this->updateManager->source('github')->update($version);

Should have brought back "7.0.0-beta.4" or similar as the most up-to-date version. Instead, it throws the cURL error. Similarly, doing this:

        $version = $this->kvpRepo->get('latest_version_tag');
        $release = $this->updateManager->source('github')->getVersionInstalled();
        dd($release);
        $this->updateManager->source('github')->update($version);

Should have brought back the version currently installed, but instead it returns null. If I adjust the config/self-update.php 'version_installed' key to the current version (as seen in php artisan phpvms:version and run the code again, this time it gives the current version but then sets this value to '' again in the config file. Upon looking into the cURL error 3, I believe it's a URL issue somewhere. So looking into the vendor's self-update GithubTagTest.php file and dumping this line it gives me this "/repos/nabeelio/phpvms/tags".

The only way I could get rid of the cURL error was to manually specify this: $url = "https://api.github.com/repos/nabeelio/phpvms/releases"; before this line in the vendor's file (which I will revert). And update the UpdateController to this:

        $version = $this->kvpRepo->get('latest_version_tag');
        $release = $this->updateManager->source('github')->getVersionAvailable();
        $this->updateManager->source('github')->update($release);

After this, the installer runs fine, no errors and the update successfully dumps to storage/app/*version. The update fails to recognise after that it has updated (still says "update available" in the admin panel" and at this point, the config/self-update.php 'version_installed' reverts to an empty string ''.

As a sidenote, if I dump $version from here:

        $version = $this->kvpRepo->get('latest_version_tag');
        $this->updateManager->source('github')->update($version);

it returns null. And I think there's supposed to be a storage/app/kvp.json file (could be wrong) but it doesn't look like there is one there. The /storage directory is set to 777 to ensure that it's not a permissions issue.

Sorry if this is a bit overkill (hopefully a simple fix) but I thought I'd do some digging. Not sure if the installer has worked prior to beta 3 or if it's a change made to beta 4.

Additional context Attached is the log file laravel-2020-05-20.log

nabeelio commented 4 years ago

Thanks for looking into this in detail! I just started taking a cursory look a few days ago. I think I need to move the kvp store into the database to start.

Question - do you have the cron setup?

web541 commented 4 years ago

Nope no cron (just a quick test locally on valet), but now that you've mentioned it that would make a difference. I wonder if the others have the cron setup.

nabeelio commented 4 years ago

Ok cool, I think I need to rework a few things including the KVP store and also running the update check on demand (which it should be doing it but it seems like there's still an issue there)

nabeelio commented 4 years ago

Also, do you have pre-release versions checked in settings? There's no release versions found so it can only go off of pre-release versions.

And beware, I have to block updates from actually happening if you're on dev, but it will downgrade from dev to a beta version which might cause problems. But I'm fixing some of the issues you've brought up right now

nabeelio commented 4 years ago

Hey, so if you download the dev version, in config/version.yaml, change prerelease to beta.3, and then try updating. The force update check should would

web541 commented 4 years ago

Pre-release wasn't checked as it was off by default, so I'll enable that. I've got a beta version and a dev version running separately so that shouldn't be an issue if I update the dev and keep it separate. Will give it a go now.

web541 commented 4 years ago

So the version control seems to be working now. Installed a fresh clone of the dev branch, checked pre-release in the settings, changed 'dev' to 'beta.3' in config/version.yaml and it looks like it updated fine. Only issue is that after it updated, /update/step1 (and sometimes /update/downloader when POST) throws a 500 due to it having installed beta.4 over the dev which reverted the changed to the Updater module

nabeelio commented 4 years ago

Ok, that's great! I just realized that the module may also be disabled. There isn't a module enable/disable panel yet.

On the dev branch, it shouldn't alert you to a new version now either. I'm gonna leave this open for now because I think there's probably another bug or two lurking in here, and I remember writing them down somewhere...

web541 commented 4 years ago

Sounds good! Yeah that's better for the dev branch. Haven't tested with your latest commit but before it would only show the alert to a new version if you did the force update which is expected (and now working).

nabeelio commented 4 years ago

I'll close this one for now

VahidNZ commented 3 years ago

Hi @nabeelio I have the same issue and as I checked my corn jb is working well and also the updater module is enabled now but I still getting the below error:

cURL error 3: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)