statamic / cli

Install and manage your Statamic projects from the command line.
71 stars 19 forks source link

Unusable when statamic.com is experiencing an outage #67

Closed jasonvarga closed 2 months ago

jasonvarga commented 5 months ago

Apparently if there's an issue with the outpost, this package doesn't work. I didn't experience it myself, I just heard it from someone else. But I'd guess it's when validating starter kit licenses.

selastingeorge commented 5 months ago

Hi are you able to fix this, I'm experiencing a similar issue when i try to create a statamic project with starter kit.

image

More Info

Statmic CLI version : v3.0.1 PHP Version : 8.3.0

Well, i run the cli from the source, i added an echo statement in the catch block and i received this as the output:

> GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://outpost.statamic.com/v3/starter-kits/statamic/starter-kit-cool-writings in C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:211
Stack trace:
#0 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(158): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(110): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(47): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(35): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#6 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#7 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#8 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Middleware.php(66): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#9 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#10 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Client.php(333): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#11 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Client.php(169): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#12 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\Client.php(189): GuzzleHttp\Client->requestAsync('GET', Object(GuzzleHttp\Psr7\Uri), Array)
#13 C:\Users\selas\Downloads\cli-master\cli-master\vendor\guzzlehttp\guzzle\src\ClientTrait.php(44): GuzzleHttp\Client->request('GET', 'https://outpost...', Array)
#14 C:\Users\selas\Downloads\cli-master\cli-master\src\NewCommand.php(354): GuzzleHttp\Client->get('https://outpost...')#15 C:\Users\selas\Downloads\cli-master\cli-master\src\NewCommand.php(114): Statamic\Cli\NewCommand->validateStarterKitLicense()
#16 C:\Users\selas\Downloads\cli-master\cli-master\vendor\symfony\console\Command\Command.php(326): Statamic\Cli\NewCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 C:\Users\selas\Downloads\cli-master\cli-master\vendor\symfony\console\Application.php(1078): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 C:\Users\selas\Downloads\cli-master\cli-master\vendor\symfony\console\Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Statamic\Cli\NewCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 C:\Users\selas\Downloads\cli-master\cli-master\vendor\symfony\console\Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 C:\Users\selas\Downloads\cli-master\cli-master\bin\statamic(29): Symfony\Component\Console\Application->run()
#21 {main}
selastingeorge commented 5 months ago

Finally i was able to fix this issue by adding this to my php.ini file: curl.cainfo = "C:\wamp64\bin\php\php8.3.0\cacert.pem"

I was able to get the cacert.pem file from here: CA certificates extracted from Mozilla

duncanmcclean commented 5 months ago

@selastingeorge That's a pretty common issue when using Windows and is unrelated to this. See #3.

duncanmcclean commented 2 months ago

Apparently if there's an issue with the outpost, this package doesn't work.

I've just tested this locally (pointed statamic.com and outpost.statamic.com to localhost).

Creating fresh sites work fine, it only errors when installing starter kits due to the license validation that happens here. I'm not sure if there's anything we could to avoid this - maybe it's fine for the small % of time the Outpost goes down?

jasonvarga commented 2 months ago

Maybe we just update the exception to say "Please try again later." 🤷