Having trouble listening for EVENT_RENDER_COMPLETE event

In my Premiere Pro UXP panel (React w/TypeScript) I would like to be able to do some action (print a console message, etc.) after exportSequence has completed, based on the events broadcasted by the AME (EVENT_RENDER_COMPLETE, EVENT_RENDER_CANCEL, etc.). I read this thread from February about how at the time there was no way to do this in UXP, but with this update from May and its use in this sample panel I believe what I want to do should now be possible. I followed the structure in the documentation and sample panel I linked above to register event listeners for the broadcasted events. However, my code doesn’t seem to be working-- either the events still aren’t being listened for/detected correctly, or they are and yet the methods that should then be called aren’t being called for some reason.

Here is the relevant portion of my code. When I call my exportActiveSequence shown below, the asynchronous exportSequence call does succeed-- the active sequence is successfully exported with the preset I provide, to the location I provide. But the event listeners are not working as renderComplete and renderCanceled are never invoked after exportSequence completes.

Things I’ve already tried:

  • Registering regular event listeners (like the sample panel)
  • Registering global event listeners (in the code below I included both regular and global in case you have feedback regarding how I’m registering either kind of listener)
  • Doing the registering in the same function/expression where I call exportSequence (see below)
  • Doing the registering earlier in the code (i.e. when the overall panel or specific scene is first rendered), before exportSequence is called (like the sample panel)
const ppro = require("premierepro");

//Functions to be called when the AME events are detected
function renderComplete() {
  console.log("Render complete");
}

function renderCanceled() {
  console.log("Render cancelled");
}

//Called by my code to export the active sequence
export const exportActiveSequence = async (pathToPresetFile: string, pathForExportOutput: string) => {
  const encoder = await ppro.EncoderManager.getManager();
  if (!encoder.isAMEInstalled) {
    console.log("Adobe Media Encoder is not installed.");
    return;
  }

   //Register event listeners for the AME events
   await ppro.EventManager.addEventListener(
    encoder,
    ppro.EncoderManager.EVENT_RENDER_COMPLETE,
    renderComplete
  );

  await ppro.EventManager.addEventListener(
    encoder,
    ppro.EncoderManager.EVENT_RENDER_CANCEL,
    renderCanceled
  );

  //Register global event listeners for the AME events
  await ppro.EventManager.addGlobalEventListener(
    ppro.EncoderManager.EVENT_RENDER_COMPLETE,
    renderComplete
  );

  await ppro.EventManager.addGlobalEventListener(
    ppro.EncoderManager.EVENT_RENDER_CANCEL,
    renderCanceled
  );
  console.log("Event listeners registered");

  const activeSequence = await getActiveSequence();
  const constants = await ppro.Constants;
  
  //This part is working
  encoder.exportSequence(
    activeSequence,
    constants.ExportType.IMMEDIATELY,
    pathForExportOutput,
    pathToPresetFile,
    true
  );
};