Error on dashboard widget from tutorial

Hello all,

I began with the development for Nextcloud. To do this, I started with the tutorials and created the both dashboard widgets from the tutorial 4 Developing a dashboard widget with Vue.js. And that worked well so far. But wthen I wanted to activate the widgets on the Nextcloud dashboard, they were not be found in the selection.
There is an entry in the error log that does not appear if the app with the widget is not available. In the tutorial I read the following part, but unfortunately I don’t know if that helps and what I have to do. Can someone please help me?

Best regards and many thanks in advance!

Part from the tutorial:
Create a l10n directory in catgifsdashboard, it is needed to make your app translatable. This directory will store the translation files.
Nextcloud provides mechanisms for internationalization (make an application translatable) and localization (add translations for specific languages). Nextcloud’s translation system is powered by Transifex. Your Nextcloud app can be translated by the Nextcloud community as well.
The automated translation files will be stored in the l10n directory. To make this work with the automated translations you do need to configure this, but we will not cover these steps in this tutorial.
You can find detailed information about how to make your app translatable in the documentation here.

Error entry of the log file:
GET /apps/dashboard/

[no app in context] Fehler: OCP\AppFramework\QueryException: Could not resolve OCP\IL10N! Class can not be instantiated at <>
0. <>
OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(“*** sensitive parameters replaced ***”)

  1. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 116
    array_map([“Closure”], ["*** sensitive … ]])
  2. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 124
    OC\AppFramework\Utility\SimpleContainer->buildClass(["ReflectionClas … "])
  3. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 142
    OC\AppFramework\Utility\SimpleContainer->resolve(“OCA\CatGifsDas … t”)
  4. /var/www/html/lib/private/ServerContainer.php line 171
    OC\AppFramework\Utility\SimpleContainer->query(“OCA\CatGifsDas … t”, true)
  5. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 65
    OC\ServerContainer->query(“OCA\CatGifsDas … t”)
  6. /var/www/html/lib/private/Dashboard/Manager.php line 78
    OC\AppFramework\Utility\SimpleContainer->get(“OCA\CatGifsDas … t”)
  7. /var/www/html/lib/private/Dashboard/Manager.php line 138
    OC\Dashboard\Manager->loadLazyPanels()
  8. /var/www/html/apps/dashboard/lib/Controller/DashboardController.php line 101
    OC\Dashboard\Manager->getWidgets()
  9. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Dashboard\Controller\DashboardController->index()
  10. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\Dashboard … "], “index”)
  11. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\Dashboard … "], “index”)
  12. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main(“OCA\Dashboard\ … r”, “index”, ["OC\AppFramewo … "], [“dashboard.dashboard.index”])
  13. /var/www/html/lib/base.php line 1056
    OC\Route\Router->match(“/apps/dashboard/”)
  14. /var/www/html/index.php line 36
    OC::handleRequest()

Caused by:
OCP\AppFramework\QueryException: Could not resolve OCP\IL10N! Class can not be instantiated at <>
0. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 142
OC\AppFramework\Utility\SimpleContainer->resolve(“OCP\IL10N”)

  1. /var/www/html/lib/private/ServerContainer.php line 171
    OC\AppFramework\Utility\SimpleContainer->query(“OCP\IL10N”, true)
  2. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 97
    OC\ServerContainer->query(“OCP\IL10N”, true)
  3. <>
    OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(“*** sensitive parameters replaced ***”)
  4. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 116
    array_map([“Closure”], ["*** sensitive … ]])
  5. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 124
    OC\AppFramework\Utility\SimpleContainer->buildClass(["ReflectionClas … "])
  6. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 142
    OC\AppFramework\Utility\SimpleContainer->resolve(“OCA\CatGifsDas … t”)
  7. /var/www/html/lib/private/ServerContainer.php line 171
    OC\AppFramework\Utility\SimpleContainer->query(“OCA\CatGifsDas … t”, true)
  8. /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php line 65
    OC\ServerContainer->query(“OCA\CatGifsDas … t”)
  9. /var/www/html/lib/private/Dashboard/Manager.php line 78
    OC\AppFramework\Utility\SimpleContainer->get(“OCA\CatGifsDas … t”)
  10. /var/www/html/lib/private/Dashboard/Manager.php line 138
    OC\Dashboard\Manager->loadLazyPanels()
  11. /var/www/html/apps/dashboard/lib/Controller/DashboardController.php line 101
    OC\Dashboard\Manager->getWidgets()
  12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Dashboard\Controller\DashboardController->index()
  13. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\Dashboard … "], “index”)
  14. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\Dashboard … "], “index”)
  15. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main(“OCA\Dashboard\ … r”, “index”, ["OC\AppFramewo … "], [“dashboard.dashboard.index”])
  16. /var/www/html/lib/base.php line 1056
    OC\Route\Router->match(“/apps/dashboard/”)
  17. /var/www/html/index.php line 36
    OC::handleRequest()

I cannot spot an error in the tutorial.

Here is a working example: mail/MailWidget.php at main · nextcloud/mail · GitHub

Is your code publicly available?

It seems rather strange to see issues with OCP classes like the IL10N as all localized apps use that class. That would mean, your nextcloud installation is seriously broken. Localization works in general?

This looks like an issue I already reported to @Daphne but seems to not have reached the tutorial yet:

There is a naming error with the PexelsService.php file which should instead be named GifService.php same as the class in it.

The error is sadly not very helpful due to some bug in the dependency injection error handling, but should improve in the future with fix: Throw early when a service cannot be found in the app container by juliushaertl · Pull Request #38322 · nextcloud/server · GitHub

4 Likes

fixed it, sorry for the delay :hugs:

1 Like

Thank you for your fast solution for my problem @juliushaertl and the fix of the tutorial @Daphne!

1 Like