getRawPathInfo() error with cronjob

In my apps Application.php I have:

public function boot(IBootContext $context): void
{
$request = $aa->getRequest();
$aa=$request->getRawPathInfo();
}

For some reason every now and then - usually when cron job does something I get an error in /var/www/nextcloud/data/nextcloud.log for the line
$aa=$request->getRawPathInfo();

The error is like this:

{"reqId":"yQxPgA6eHNrdJRXAxu7a","level":4,"time":"2023-11-30T11:35:01+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Could not boot saso: The requested uri() cannot be processed by the script '/var/www/nextcloud/cron.php')","userAgent":"--","version":"25.0.3.2","exception":{"Exception":"Exception","Message":"The requested uri() cannot be processed by the script '/var/www/nextcloud/cron.php')","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/saso/lib/AppInfo/Application.php","line":100,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":190,"function":"boot","class":"OCA\\saso\\AppInfo\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":208,"function":"bootApp","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":141,"function":"loadApp","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/cron.php","line":55,"function":"loadApps","class":"OC_App","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Request.php","Line":733,"message":"Could not boot saso: The requested uri() cannot be processed by the script '/var/www/nextcloud/cron.php')","exception":{},"CustomMessage":"Could not boot saso: The requested uri() cannot be processed by the script '/var/www/nextcloud/cron.php')"}}

What can I do to prevent this? If I leave the “$aa=$request->getRawPathInfo();” out now error is reported on the nextcloud.log.

First of all you should update your cloud. 25 is EOL and if you want it to be 25, then you should, for security reasons at least update to the last bugfix release 25.0.13.

cron is trying to bootstrap an app called saso.

I personaly have never heard about a nextcloud app with the ap_id saso. If you know what app that is, then you should maybe install it right or if it is just a “forgotten” directory inside of your apps directory, then you should remove it from there.

If that not solves your problem, could you please give the output of these two occ commands:

occ app:list
occ background-job:list -l 1000 | grep "saso"

Much luck,
ernolf

I guess it’s not possible to use getRawPathInfo.

If the script was called via cron IRequest is not available/not fully populated.
Therefore, you may want to move the code that depends on IRequest out of boot.

Is there any simple workaround to test if getRawPathInfo is not ready or use some other simple way?

I would say: Never in the boot method. I was also curious if this was possible at all. Btw, it is not clear, what $aa in your example is referring to.

A real answer to your question is not possible, it is a clear it depends. I guess, you are at least partially developing the app. So, you should know hat you want to achieve. Maybe we start there and the problem can be solved more straight forward. What are you trying to achieve?

I am trying to find about what methods work as intended and what methods don’t work on occasion.

what methods work

What do yo mean here?
Are you talking about understanding the NC development process? Or just trying out how nasty/complex/crazy one can hack into the server? Or are you talking about the HTML verbs? Or are you talking of controller methods?