Notify_push installation error (NC21 files HPB)

This just happened on my Arch server (current) (NC 21.0.0.18, NGINX+PHP 8.0.2(php-fpm), MariaDB) installation (as webserver user) when trying to follow instructions to install the files HPB:

$ php occ app:install notify_push
An unhandled exception has been thrown:
TypeError: substr(): Argument #3 ($length) must be of type ?int, bool given in /server/test/apps/notify_push/lib/SetupWizard.php:84
Stack trace:
#0 /server/test/apps/notify_push/lib/SetupWizard.php(84): substr()
#1 /server/test/apps/notify_push/lib/Migration/Install.php(42): OCA\NotifyPush\SetupWizard->testBinary()
#2 /server/test/lib/private/Repair.php(117): OCA\NotifyPush\Migration\Install->run()
#3 /server/test/lib/private/legacy/OC_App.php(1054): OC\Repair->run()
#4 /server/test/lib/private/Installer.php(175): OC_App::executeRepairSteps()
#5 /server/test/core/Command/App/Install.php(68): OC\Installer->installApp()
#6 /server/test/apps/mail/vendor/symfony/console/Command/Command.php(255): OC\Core\Command\App\Install->execute()
#7 /server/test/apps/mail/vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run()
#8 /server/test/apps/mail/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand()
#9 /server/test/apps/mail/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun()
#10 /server/test/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#11 /server/test/console.php(100): OC\Console\Application->run()
#12 /server/test/occ(11): require_once('...')
#13 {main}http@server /server/test

$ php occ app:install notify_push
notify_push already installed

So, it WAS installed the first time, but what error is that?

Please report the error including stack trace to Issues · nextcloud/notify_push · GitHub.

strrpos seems to return false for your app version. You may add some debugging code like

var_dump($appVersion); exit; before line 84 and execute the command. It should print the app version then and help to add a check for this state (app version has weird value).

I’m happy to do so – but I’m not sure how I can do the debugging you proposed:
The error happens when I install the app, so occ fetches it from apps.nextcloud.com, extracts it and installs it. THAT is where the error happens. You propose to add a debug line in a file that is not yet there. And once it IS installed, I don’t get the error. Inserting your debug code doesn’t change anything since OCC doesn’t execute this as it aborts telling me that it’s “already installed” – or is there a “force-reinstall”? But even if there were the debug code would be overwritten.

Now, concernng the stack trace – so you mean the log file entry? It looks like I didn’t log warnings.

But since had something misconfigured by that time, other errors were logget. Since I see “mail” in that log entry(!), I suspect that this is the error I already reported:

{"reqId":"[ID]","level":3,"time":"2021-02-28T20:39:45+01:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"fsockopen(): Unable to connect to localhost:7867 (Connection refused) at /server/test/apps/notify_push/lib/SetupWizard.php#92","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/server/test/apps/notify_push/lib/SetupWizard.php","line":92,"function":"fsockopen"},{"file":"/server/test/apps/notify_push/lib/Command/Setup.php","line":137,"function":"isPortFree","class":"OCA\\NotifyPush\\SetupWizard","type":"->"},{"file":"/server/test/apps/**mail**/vendor/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OCA\\NotifyPush\\Command\\Setup","type":"->"},{"file":"/server/test/apps/**mail**/vendor/symfony/console/Application.php","line":971,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/server/test/apps/**mail**/vendor/symfony/console/Application.php","line":290,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/server/test/apps/**mail**/vendor/symfony/console/Application.php","line":166,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/server/test/lib/private/Console/Application.php","line":215,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/server/test/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/server/test/occ","line":11,"args":["/server/test/console.php"],"function":"require_once"}],"File":"/server/test/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"--","version":"21.0.0.18"}

occ app:install notify_push --keep-disabled
patch the file
occ app:enable notify_push

Same result.

$ php occ app:install notify_push --keep-disabled
An unhandled exception has been thrown:
TypeError: substr(): Argument #3 ($length) must be of type ?int, bool given in /server/www/seyfarth/test/apps/notify_push/lib/SetupWizard.php:84

Mind that the app is installed despite of the error, and that it seems work fine!

Digging deeper: Since the stack trace in the original post (identical with the one I see now) shows mail, I uninstalled the mail app. Upon installing notify_push, now bookmarks is in the stack trace! OK, so I uninstalled bookmarks, too. 3rd try yields this:

$ php occ app:install notify_push --keep-disabled
An unhandled exception has been thrown:
TypeError: substr(): Argument #3 ($length) must be of type ?int, bool given in /server/test/apps/notify_push/lib/SetupWizard.php:84
Stack trace:
#0 /server/test/apps/notify_push/lib/SetupWizard.php(84): substr()
#1 /server/test/apps/notify_push/lib/Migration/Install.php(42): OCA\NotifyPush\SetupWizard->testBinary()
#2 /server/test/lib/private/Repair.php(117): OCA\NotifyPush\Migration\Install->run()
#3 /server/test/lib/private/legacy/OC_App.php(1054): OC\Repair->run()
#4 /server/test/lib/private/Installer.php(166): OC_App::executeRepairSteps()
#5 /server/test/core/Command/App/Install.php(68): OC\Installer->installApp()
#6 /server/test/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\App\Install->execute()
#7 /server/test/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#8 /server/test/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#9 /server/test/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#10 /server/test/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#11 /server/test/console.php(100): OC\Console\Application->run()
#12 /server/test/occ(11): require_once('...')

Nothing I could uninstall … so, what to do now?

Sidenote: I could not re-install mail since it is not compatible with NC21 yet – BUT: isn’t mail PART of NC 21 Hub release?

Mail is not the problem here :wink:

You may download the app release from Releases · nextcloud/notify_push · GitHub, extract it to apps directory, patch it and enable the app.

Thanks :+1:

84: var_dump($appVersion); exit; yields string(5) "0.1.5"

Please report it on GitHub :wink: