Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
103 stars 71 forks source link

Mirador block throwing errors #2073

Closed rosiel closed 1 month ago

rosiel commented 2 years ago

Getting the following error when trying to use Mirador:

TypeError: NetworkError when attempting to fetch resource.

This happens when using Mirador as a field formatter on a Media, as well as when displayed as an EVA block. It's happening on the Playbook as well as the Sandbox, and ISLE built with the install profile. The full error message in the viewer is:

{
  "manifest": {
    "error": "TypeError: NetworkError when attempting to fetch resource.",
    "id": "http://localhost:8000/node/504/manifest",
    "isFetching": false
  },
  "window": {
    "collectionIndex": 0,
    "companionAreaOpen": true,
    "companionWindowIds": [
      "cw-92e69f66-c72d-4e58-99eb-809fd5f6dd89",
      "cw-3054e291-f518-49c8-93a0-268464a0ea52"
    ],
    "draggingEnabled": true,
    "highlightAllAnnotations": false,
    "id": "window-079edee1-1fad-410d-8f7c-d5e6ef4d5f71",
    "manifestId": "http://localhost:8000/node/504/manifest",
    "maximized": false,
    "rangeId": null,
    "rotation": null,
    "selectedAnnotations": {},
    "sideBarOpen": false,
    "sideBarPanel": "info",
    "thumbnailNavigationId": "cw-3054e291-f518-49c8-93a0-268464a0ea52",
    "thumbnailNavigationPosition": "far-bottom"
  }
}
rosiel commented 2 years ago

From the tech call (@seth-shaw-unlv thanks) it may be that the config here (localhost:8000) is wrong and there's and isle/playbook issue.

rosiel commented 2 years ago

Indeed, it was missing :8000 from the config. That solved the red NetworkError, but led to new errors.

Screen Shot 2022-04-06 at 3 15 06 PM

This "unexpected non-whitespace character after JSON data" appeared as a modal over the viewer, and in the logs i see

Error: Call to a member function id() on null in Drupal\islandora_mirador\Plugin\Block\MiradorBlock->build() (line 111 of /var/www/html/drupal/web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php)

#0 /var/www/html/drupal/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\islandora_mirador\Plugin\Block\MiradorBlock->build()
#1 [internal function]: Drupal\block\BlockViewBuilder::preRender(Array)
#2 /var/www/html/drupal/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array(Array, Array)
#3 /var/www/html/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(772): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
seth-shaw-unlv commented 2 years ago

It looks like whatever page you were on isn't returning a node as part of the route: https://github.com/Islandora/islandora_defaults/blob/2.x/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php#L109