Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpaca event errors triggered when choosing file in the add media form #262

Open
jefferya opened this issue May 19, 2022 · 2 comments
Open

Comments

@jefferya
Copy link
Contributor

When adding a new media item, immediately after choosing a file (and before saving the form), two events are triggered leading to the following two errors in Alpaca

  • Cannot find JSONLD URL in event message - queue: islandora-indexing-triplestore-index
  • Failed to invoke method: .object.url[1].href on ca.islandora.alpaca.support.event.AS2Event due to - java.lang.ArrayIndexOutOfBoundsException: 1 - queue: islandora-indexing-fcrepo-media

Steps to reproduce:

  • add resource (title, resource type ==> moving image, model ==> video)
  • follow Alpaca container log
  • add media -> video -> attach file (stop before saving form)
  • view Alpaca logs and see errors for queue islandora-indexing-triplestore-index and :islandora-indexing-fcrepo-media

Unable to reproduce via workbench

The code that emits the events only adds a url if $entity_type != 'file' and in the above case the entity_type is 'file' thus no url is added to the event/message which in turn causes the alpaca errors as the handles for islandora-indexing-triplestore-index and islandora-indexing-fcrepo-media expect a url attached to the message

https://github.com/Islandora/islandora/blob/d8d101e5710c42804f06eff0f6c6a4ee3c69adbd/src/EventGenerator/EventGenerator.php#L118-L134

    // Add REST links for non-file entities.
    if ($entity_type != 'file') {
      $event['object']['url'][] = [
        "name" => "JSON",
        "type" => "Link",
        "href" => $this->utils->getRestUrl($entity, 'json'),
        "mediaType" => "application/json",
        "rel" => "alternate",
      ];
      $event['object']['url'][] = [
        "name" => "JSONLD",
        "type" => "Link",
        "href" => $this->utils->getRestUrl($entity, 'jsonld'),
        "mediaType" => "application/ld+json",
        "rel" => "alternate",
      ];
    }

Question: should islandora-indexing-triplestore-index and islandora-indexing-fcrepo-media messages be triggered during the file choose action (before the add media form submitted)?

@jefferya
Copy link
Contributor Author

Addendum:

@rosiel
Copy link
Contributor

rosiel commented May 25, 2022

It seems this is standard behaviour, as hook_file_insert() is used to launch file actions. https://github.com/Islandora/islandora/blob/2.x/islandora.module#L169-L177

So this isn't actually an isle-dc issue, or one with that PR (though thanks for specifying what you were using!)

From the Tech Call, this does seem like something we want to address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants