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

Callback scheduled task causes fatal error #15

Open
ygrigoriev opened this issue Jul 6, 2023 · 0 comments
Open

Callback scheduled task causes fatal error #15

ygrigoriev opened this issue Jul 6, 2023 · 0 comments

Comments

@ygrigoriev
Copy link

It's possible to set scheduled task as callable class inside \App\Console\Kernel, like this:

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->call(new NotificationTask())->everyMinute();
    }

in this case calling artisan schedule:run fails with the error

  2023-07-06 10:43:26 Running [Callback] .......................................... 0ms FAIL

   TypeError 

  JackWH\LaravelNewRelic\NewRelicTransactionHandler::parseTaskCommand(): Argument #1 ($taskCommand) must be of type string, null given, called in /application/vendor/jackwh/laravel-new-relic/src/NewRelicTransactionHandler.php on line 205

  at vendor/jackwh/laravel-new-relic/src/NewRelicTransactionHandler.php:269
    265▕ 
    266▕     /**
    267▕      * Parse a command string for a scheduled task, returning it in a simplified format.
    268▕      */
  ➜ 269▕     protected function parseTaskCommand(string $taskCommand): string
    270▕     {
    271▕         $formattedCommand = Str::of($taskCommand)
    272▕             ->afterLast("'artisan' ")
    273▕             ->afterLast("artisan ")

      +20 vendor frames 

  21  artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant