Error Call to undefined method OCP - Web UI not working

Nextcloud version (eg, 29.0.5): Nextcloud AIO v9.4.1 / Hub 8 (29.0.4)
Operating system and version (eg, Ubuntu 24.04): Debian 12 (Linux 6.1.0-25-amd64 Debian 6.1.106-3)
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.62
PHP version (eg, 8.3): 8.2.21

The issue you are facing:

  • Error Call to undefined method OCP - Web UI not working

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Normal AIO installation behind Nginx Reverse Proxy running smoothly
  2. Installed last updates
  3. Noticed that a new https session can’t be estabilished

The output of your Nextcloud log in Admin > Logging:

Can’t access the Nextcloud HTTPS interface.
I remember this error before the last active session was kicked out:

Error: Call to undefined method OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent::isLoggedIn()"

Also found this:

{"reqId":"XtXp9bVQu8DGU7Miz6qF","level":3,"time":"2024-09-05T19:23:23+00:00","remoteAddr":"10.10.67.4","user":"--","app":"index","method":"GET","url":"/login","message":"Call to undefined method OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent::isLoggedIn()","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0","version":"29.0.4.1","exception":{"Exception":"Error","Message":"Call to undefined method OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent::isLoggedIn()","Code":0,"Trace":[{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Unsplash\\EventListener\\BeforeTemplateRenderedEventListener","type":"->","args":[["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"],"OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent",["Symfony\\Component\\EventDispatcher\\EventDispatcher"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"],["Closure"],["Closure"],["Closure"]],"OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent",["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"],"OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent",["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"]]},{"file":"/var/www/html/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php","line":50,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent"]]},{"file":"/var/www/html/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":142,"function":"afterController","class":"OC\\AppFramework\\Middleware\\AdditionalScriptsMiddleware","type":"->","args":[["OC\\Core\\Controller\\LoginController"],"showLoginForm",["OCP\\AppFramework\\Http\\TemplateResponse"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":175,"function":"afterController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[["OC\\Core\\Controller\\LoginController"],"showLoginForm",["OCP\\AppFramework\\Http\\TemplateResponse"]]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OC\\Core\\Controller\\LoginController"],"showLoginForm"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\LoginController","showLoginForm",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["core.login.showloginform"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/login"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/unsplash/lib/EventListener/BeforeTemplateRenderedEventListener.php","Line":82,"message":"Call to undefined method OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent::isLoggedIn()","exception":{},"CustomMessage":"Call to undefined method OCP\\AppFramework\\Http\\Events\\BeforeLoginTemplateRenderedEvent::isLoggedIn()"}}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'appsallowlist' => false,
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => 'edited',
    'port' => 6379,
  ),
  'overwritehost' => 'nextcloud.edited.extension',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'edited',
  'secret' => 'edited',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'nextcloud.edited.extension',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '29.0.4.1',
  'overwrite.cli.url' => 'https://nextcloud.edited.extension/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => 'edited',
  'installed' => true,
  'instanceid' => 'edited',
  'maintenance' => false,
  'loglevel' => 2,
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => 10485760,
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'jpeg_quality' => 60,
  'enabledPreviewProviders' =>
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
  ),
  'enable_previews' => true,
  'upgrade.disable-web' => true,
  'mail_smtpmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 30',
  'activity_expire_days' => 30,
  'simpleSignUpLink.shown' => false,
  'share_folder' => '/Shared',
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'upgrade.cli-upgrade-link' => 'https://github.com/nextcloud/all-in-one/discussions/2726',
  'updatedirectory' => '/nc-updater',
  'maintenance_window_start' => 100,
  'allow_local_remote_servers' => true,
  'davstorage.request_timeout' => 3600,
  'htaccess.RewriteBase' => '/',
  'dbpersistent' => false,
  'auth.bruteforce.protection.enabled' => true,
  'ratelimit.protection.enabled' => true,
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
    10 => '172.18.0.0/16',
  ),
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'preview_imaginary_key' => '6b2e517ea8133e6590713f660d796a11278bd3a98a05a749',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'service',
  'mail_domain' => 'edited',
  'mail_smtphost' => 'edited',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'edited',
  'mail_smtppassword' => edited,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'mail_smtpsecure' => 'ssl',
  'app_install_overwrite' =>
  array (
    0 => 'unsplash',
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Connection to nextcloud-aio-nextcloud (172.18.0.12) 9000 port [tcp/*] succeeded!
[Thu Sep 05 19:23:06.977819 2024] [mpm_event:notice] [pid 66:tid 66] AH00489: Apache/2.4.62 (Unix) configured -- resuming normal operations
[Thu Sep 05 19:23:06.977912 2024] [core:notice] [pid 66:tid 66] AH00094: Command line: '/usr/local/apache2/bin/httpd -D FOREGROUND'
{"level":"info","ts":1725564187.0059526,"msg":"using config from file","file":"/tmp/Caddyfile"}
{"level":"info","ts":1725564187.00806,"msg":"adapted config to JSON","adapter":"caddyfile"}

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

nextcloud.log is empty

Thank you so much!

Hi @Jetro,

Your error message is coming from the app unsplash:

… but you forced the use of this app:

… which is not supported by Nextcloud 29.


Simply remove that app:

occ app:disable unsplash

… and remove the 'app_install_overwrite' array from your config/config.php


ernolf

3 Likes

Thank you so much, Ernolf, that solved my problem.

How can I have forced it? I didn’t did it intentionally and don’t want it happening again. Maybe a flag somewhere?

Thank you again

This array is usually created when you force enable an app in the web interface that is marked as incompatible with a particular Nextcloud version.

Force enabling apps often works fine as long as there are no real incompatibilities with Nextcloud. However, over time, as Nextcloud continues to change and the app doesn’t, issues will arise, and that’s probably what happened here with unsplash.

1 Like