e-alfred / nextcloud-printer

App to allow direct printing from Nextcloud through LPR/CUPS-connected printers
GNU General Public License v3.0
23 stars 9 forks source link

Exception in AppInfo/Application.php for Nextcloud 19 with version 0.0.4 #13

Closed aszlig closed 3 years ago

aszlig commented 3 years ago

Got this exception during one of my automated tests during occ app:list:

Interface 'OCP\AppFramework\Bootstrap\IBootstrap' not found

{
  "Exception": "Error",
  "Message": "Interface 'OCP\\AppFramework\\Bootstrap\\IBootstrap' not found",
  "Code": 0,
  "Trace": [
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/composer/composer/ClassLoader.php",
      "line": 444,
      "function": "include"
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/composer/composer/ClassLoader.php",
      "line": 322,
      "function": "Composer\\Autoload\\includeFile",
      "args": [
        "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/apps/printer/lib//AppInfo/Application.php"
      ]
    },
    {
      "function": "loadClass",
      "class": "Composer\\Autoload\\ClassLoader",
      "type": "->",
      "args": [
        "OCA\\Printer\\AppInfo\\Application"
      ]
    },
    {
      "function": "spl_autoload_call",
      "args": [
        "OCA\\Printer\\AppInfo\\Application"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/Route/Router.php",
      "line": 401,
      "function": "class_exists",
      "args": [
        "OCA\\Printer\\AppInfo\\Application"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/Route/Router.php",
      "line": 380,
      "function": "setupRoutes",
      "class": "OC\\Route\\Router",
      "type": "->",
      "args": [
        {
          "routes": [
            {
              "name": "printer#printfile",
              "url": "/printfile",
              "verb": "GET"
            }
          ]
        },
        "printer"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/Route/Router.php",
      "line": 151,
      "function": "requireRouteFile",
      "class": "OC\\Route\\Router",
      "type": "->",
      "args": [
        "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/apps/printer/appinfo/routes.php",
        "printer"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/Route/Router.php",
      "line": 331,
      "function": "loadRoutes",
      "class": "OC\\Route\\Router",
      "type": "->",
      "args": []
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/URLGenerator.php",
      "line": 83,
      "function": "generate",
      "class": "OC\\Route\\Router",
      "type": "->",
      "args": [
        "mail.page.index",
        []
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/apps/mail/appinfo/app.php",
      "line": 42,
      "function": "linkToRoute",
      "class": "OC\\URLGenerator",
      "type": "->",
      "args": [
        "mail.page.index"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/legacy/OC_App.php",
      "line": 266,
      "args": [
        "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/apps/mail/appinfo/app.php"
      ],
      "function": "require_once"
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/legacy/OC_App.php",
      "line": 155,
      "function": "requireAppFile",
      "class": "OC_App",
      "type": "::",
      "args": [
        "mail"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/lib/private/legacy/OC_App.php",
      "line": 128,
      "function": "loadApp",
      "class": "OC_App",
      "type": "::",
      "args": [
        "mail"
      ]
    },
    {
      "file": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/cron.php",
      "line": 54,
      "function": "loadApps",
      "class": "OC_App",
      "type": "::",
      "args": []
    }
  ],
  "File": "/nix/store/3i3zfspxyzs3vsvnwriqknadhaxdvwsi-nextcloud-19.0.6.2/apps/printer/lib/AppInfo/Application.php",
  "Line": 33,
  "CustomMessage": "--"
}

Note: As mentioned, these are automated tests and I have no instances of Nextcloud 19 in production, so this is not something I'd personally consider urgent to fix and can't manually test.

Here's the full log of the test session.

t-markmann commented 3 years ago

This causes:

PHP Fatal error: Interface 'OCP\AppFramework\Bootstrap\IBootstrap' not found in /nextcloud/apps/printer/lib/AppInfo/Application.php on line 33

Related to Talk? From the logs: {"reqId":"oPECn9gNaTCuOnjSpsKN","level":3,"time":"2020-12-18T07:07:24+00:00","remoteAddr":"IP","user":"--","app":"PHP","method":"GET","url":"/nextcloud/ocs/v2.php/apps/spreed/api/v1/chat/5sx58rnc?lookIntoFuture=1&lastKnownMessageId=275248&includeLastKnown=0","message":"Interface 'OCP\AppFramework\Bootstrap\IBootstrap' not found at /nextcloud/apps/printer/lib/AppInfo/Application.php#33","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15","version":"19.0.4.2"}

lazyprog commented 3 years ago

The same issues

I had ERROR 500 after update Printer via Settings - Applications

then check: sudo -u www-data php occ check

PHP Fatal error: Interface 'OCP\AppFramework\Bootstrap\IBootstrap' not found in /var/www/nextcloud/apps/printer/lib/AppInfo/Application.php on line 33

had remove /var/www/nextcloudapps/printer to /tmp folder - bingo, Nextcloud works again!

aszlig commented 3 years ago

Related to Talk?

Nope, this is clearly an issue with the printer app, since it uses IBootstrap which did not exist in Nextcloud 19 (here is the commit which introduced it).

kesselb commented 3 years ago

Hi, @e-alfred would you mind to have a look? IBootstrap is only available for Nextcloud 20 and above. If one installs the app on Nextcloud 19 it fails hard.

Unfortunately there is no easy way to release a app for Nextcloud 19 and Nextcloud 20. I would suggest to release 0.4 only for Nextcloud 20. If you change apps frequently and want to maintain a version for 19 and 20 different branches might help.

May @rello has some advice for you. I think he run into a similar issue with Analytics recently.

Rello commented 3 years ago

Hello, yes, I had the same pain for Audio Player & Analytics. at the end I went with 2 sepearate apps.

you need to Application.php files - one for the new, one for the old stuff and separate them by the technical version number. you can check this commit for the first 4 files:

https://github.com/Rello/audioplayer/commit/193f719d1b9d7bc27873d1fcd43177bb15073fae

its a pain, but thats like it is. i decided for separate versions afterwards

tavinus commented 3 years ago

Made the update and our Nextcloud was completely broke. Had to manually move/delete the apps/printer folder, since the occ command would also not run. This is quite severe.

After moving the folder I still disabled the app with:

cd /var/www/owncloud/
sudo -u www-data php ./occ app:disable printer

Glad to have it back online.

So, until NC20 should I just not use the printer App?

kesselb commented 3 years ago

So, until NC20 should I just not use the printer App?

Until a fixed version is available Printer 0.0.3 https://apps.nextcloud.com/apps/printer/releases?platform=19 still works. But keep in mind that Nextcloud updates all apps automatically during a upgrade.

e-alfred commented 3 years ago

Sorry for the inconvenience, I just didn't bump the min-version in appinfo/info.xml. I removed the problematic release from the app store and uploaded a new one that only support Nextcloud 20 and up. If you run an older version, you can still use 0.0.3 for the time being.