Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled Commands #313

Open
connor-devuk opened this issue May 22, 2024 · 6 comments
Open

Scheduled Commands #313

connor-devuk opened this issue May 22, 2024 · 6 comments
Assignees
Labels
bug Something isn't working f/scheduler

Comments

@connor-devuk
Copy link

What were you trying to do?

I have a command which sends some data to my API every 30 minutes.

What happened?

I cannot have scheduled commands to call my API because it errors with a curl ssl error:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://xxxxxx.xxxx

Now I know you'd think this is a me issue however I think its todo with the way you run the schedule command, as if I run the php artisan schedule:run command manually or the actual artisan command I have for it, it works just fine.

Maybe it's something i have setup weirdly on my end but to my knowledge everything is fine

How to reproduce the bug

Have a scheduled command run every minute (or whatever) and have it call send an API request via Laravels Http library

Package Versions

0.5.1

PHP Version

8.1

Laravel Version

10.48

Node Version

18.18.2

Which operating systems have you seen this occur on?

macOS

OS version

macos14.4.1

Notes

No response

@connor-devuk connor-devuk added the bug Something isn't working label May 22, 2024
@simonhamp simonhamp self-assigned this May 31, 2024
@simonhamp
Copy link
Member

@connor-devuk are you trying to call a public service or a local test service with a self-signed cert? (e.g. a secure Herd or Valet site)

@simonhamp
Copy link
Member

I've managed to reproduce this only when I'm calling a service that's using a self-signed certificate.

If you're using Laravel's HTTP facade (which is built on top of Guzzle), you can get around this by adding the following to your AppServiceProvider:

use Illuminate\Support\Facades\Http;

public function boot(): void
{
    if ($this->app->environment('local')) {
        Http::globalOptions([
            'verify' => false
        ]);
}

Of course, in practice, you don't want to bypass certificate verification like this for anything important, as you can't trust that the certificate is valid and thus that the TLS connection is safe.

@connor-devuk
Copy link
Author

I've managed to reproduce this only when I'm calling a service that's using a self-signed certificate.

If you're using Laravel's HTTP facade (which is built on top of Guzzle), you can get around this by adding the following to your AppServiceProvider:

use Illuminate\Support\Facades\Http;



public function boot(): void

{

    if ($this->app->environment('local')) {

        Http::globalOptions([

            'verify' => false

        ]);

}

Of course, in practice, you don't want to bypass certificate verification like this for anything important, as you can't trust that the certificate is valid and thus that the TLS connection is safe.

@simonhamp I come across this issue when calling my services API end point hosted on AWS which has an SSL certificate issued by LetsEncrypt

@simonhamp
Copy link
Member

@connor-devuk could you tell me which version of nativephp/php-bin you're running? My theory is that it could be an out-of-date CA file

@connor-devuk
Copy link
Author

@connor-devuk could you tell me which version of nativephp/php-bin you're running? My theory is that it could be an out-of-date CA file

            "nativephp/php-bin": "^0.4",

@simonhamp
Copy link
Member

@connor-devuk are you able to update to the latest versions of the packages so that you can get the latest CA file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working f/scheduler
Projects
None yet
Development

No branches or pull requests

2 participants