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

KEEP-errors after adding media #550

Closed
seth-shaw-asu opened this issue Aug 9, 2022 · 4 comments
Closed

KEEP-errors after adding media #550

seth-shaw-asu opened this issue Aug 9, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@seth-shaw-asu
Copy link
Contributor

Reported to askalibrarian on 2022-08-04:

Today we are getting this error after adding media to a child when we save: The website encountered an unexpected error. Please try again later.
The media is actually getting uploaded and plays fine, but we have to keep opening new tabs and find the performance over and over again to add media to each child, which is time consuming.

@seth-shaw-asu seth-shaw-asu added the bug Something isn't working label Aug 9, 2022
@seth-shaw-asu
Copy link
Contributor Author

Early analysis indicated these errors were occuring because the EmitEvent's generateData (which grabs the action's configuration) was returning null, which then the new StompHeaderEvent would choke on.

I added a check to hopefully give us some more information:

diff --git a/src/EventGenerator/EmitEvent.php b/src/EventGenerator/EmitEvent.php
index 683f3e8b..20cc22d1 100644
--- a/src/EventGenerator/EmitEvent.php
+++ b/src/EventGenerator/EmitEvent.php
@@ -157,7 +157,11 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact

       $user = $this->entityTypeManager->getStorage('user')->load($this->account->id());
       $data = $this->generateData($entity);
-
+# DEBUGGING
+      if (is_null($data)) {
+        throw new StompHeaderEventException("Could not load event configuration data for entity '".$entity->label()."': ".$this->getPluginId());
+      }
+# END DEBUGGING
       $event = $this->eventDispatcher->dispatch(
         StompHeaderEvent::EVENT_NAME,
         new StompHeaderEvent($entity, $user, $data, $this->getConfiguration())

I asked the ticket's reporter to try again and they replied that the media creation now works (yay for no WSOD) but also provided the error message

Could not load event configuration data for entity 'Serenade, op. 35': generate_derivative_file.

I did a quick grep of our config and found that only the system.action.caption_generate_captions_via_aws_transcribe_for_audio_video_onl.yml makes reference to this plugin. I'll look into this a bit more.

@seth-shaw-asu
Copy link
Contributor Author

Primary issue:

First, a correction: while EmitEvent::generateData() does grab the config, it is overridden by the derivative action classes that extend it.

Our Audio derivatives context triggers both media and node reactions. This means our Transcribe reaction, which uses the media context is being triggered with an entity reference to the node. However, AbstractGenerateDerivateMediaFile::generateData() returns nothing if the entity isn't a Media. This then causes the $data value to be Null and crash the EmitEvent class.

That line should return $data; which will at least grab the data from parent classes. (If nothing else, the config array as provided by EmitEvent itself.)

Side issue:

@ 05b2502#diff-029d6e57e7e56013e1ba490ab7d1f56ea2a66e4c3eca6cdd726ddfc93924a8ca we shifted from field_caption to field_track.

However, the AbstractGenerateDerivativeMediaFile config form only supports file fields while our field_track is a media_track. We updated this config using the config sync system, so it works, but we can't update it via the web interface. This should probably be reported as a separate Islandora issue.

@seth-shaw-asu
Copy link
Contributor Author

The provided PR takes a different approach by throwing an error that EmitEvent can then catch and report out.

@seth-shaw-asu
Copy link
Contributor Author

Resolved with Islandora/islandora@62fbc6d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant