jsPsych Pavlovia plugin - Problems with redirecting participants after completion

URL of experiment:

Description of the problem:

I am running an online experiment programmed with jsPsych and which I host on Pavlovia. Thus, I use the jsPsych Pavlovia plugin (2022.1.1) for communication with the Pavlovia server. Participants’ data is successfully uploaded to the server when they complete the experiment but I got feedback that on their side the experiment “freezes” after the last trial with the message “Please wait a moment while the data are uploaded to the pavlovia.org server…”. This prevents participants to get to the redirection URL that would send them back to Prolifics where I recruit participants (causing messages about the problem, missing completion codes for participants, and potential timed-out status if participants do not close the last page themselves).

How am I supposed to embed the proper ending of the experiment within my code?

Currently it looks the following (previous lines omitted):

  1. Finish connection with pavlovia

     var pavlovia_finish = {
         type: jsPsychPavlovia,
         command: "finish",
         participantId: subject_id,
  2. Insert waiting trial to ensure upload to the server is completed

     var wait5sec = {
         type: 'html-keyboard-response',
         stimulus: `<div class="message">
             <p>Wait while your data is being saved...</p>
         choices: "NO_KEYS",
         trial_duration: 5000
  3. Redirect participants to prolific by clicking a link

     var redirect_trial = {
          type: jsPsychHtmlKeyboardResponse,
          stimulus: `<div class="message">
              <p>Thank you very much for participating!</p>
              <p><a href="https://app.prolific.co/submissions/complete?cc=XXXXXX">Click here to return to Prolific and complete the study</a>.</p>
          choices: "NO_KEYS"
  4. Run experiment


So the problem seems to be that participants never make it to the waiting and redirect trial. Are all trials pushed after the pavlovia_finish trial omitted? Am I missing some statement in the pavlovia_finish trial (e.g., completedCallbackfunction)?

Any help or hints very appreciated!