Skip to content

Assignment of null to a string property since the new version #36

@jonnywilliamson

Description

@jonnywilliamson

Hi there,

I've been using this nova plugin for quite a while now with no issues, until a few days ago after I updated it. Haven't changed anything in the config etc, but when I run my command from the nova dashboard I get a server 500 error.

The error is as follows in the log:

[2024-04-23 09:07:07] production.ERROR: Cannot assign null to property Stepanenko3\NovaCommandRunner\Dto\RunDto::$run_by of type string {"userId":48204,"exception":"[object] (TypeErro
[stacktrace]
#0 /home/forge/crewapps.co/vendor/stepanenko3/nova-command-runner/src/Http/Controllers/CommandsController.php(117): Stepanenko3\\NovaCommandRunner\\Dto\\RunDto->__construct()
#1 /home/forge/crewapps.co/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): Stepanenko3\\NovaCommandRunner\\Http\\Controllers\\CommandsController->run()
#2 /home/forge/crewapps.co/vendor/laravel/framework/src/Illuminate/Routing/Route.php(260): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#3 /home/forge/crewapps.co/vendor/laravel/framework/src/Illuminate/Routing/Route.php(206): Illuminate\\Routing\\Route->runController()
#4 /home/forge/crewapps.co/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()

Having a look at the RunDto I see a recent change in commit

954ae26#diff-34ea08736004df131df35da01543bdd3ea44ce5506612c743557fb6b63833cf3L9-L21

Where you marked everything apart from $run_by as a nullable string

However in your CommandsController.php you try and run the command with a new RunDTO() object that has no parameters and so it's trying to set $run_by as null and so throwing the error. (I think).

https://github.com/stepanenko3/nova-command-runner/blob/main/src/Http/Controllers/CommandsController.php#L117

Not sure what would be best here, but thought I'd just highlight it as an issue as I can't get the commands to run online anymore.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions