# Unspecified JavaScript error & error closing session

**URL:** <https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042>\
**Category:** Online experiments\
**Created:** [April 5, 2021, 1:31pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042 "2021-04-05T13:31:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 5, 2021, 1:31pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/1 "2021-04-05T13:31:04Z")

</div>

URL of experiment: (but it is in piloting mode, don’t know if you can still view the code…)  
[https://run.pavlovia.org/Rika/masterarbeitsstudie\_bevi\_2021/html/](https://run.pavlovia.org/Rika/masterarbeitsstudie_bevi_2021/html/)

Description of the problem:  
When I run the experiemnt on some devises, I get an error when trying to end the experiment. At the end, the orange dialog box appears and is followed directly by an error message saying it had problems closing the sessions. The data file (csv) can then still be viewed directly in the browser, but I cannot download the result from the pavlovia server afterwards (it returns an empty zip folder, despite there being some complete data files – meaning, one faulty file seems to crash the whole folder).

 ![error message ipad](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/c/ec2457d0b9c18a4d76d06d76b3f7e9a8f6882013.png)

I noticed, that this happens when I use an ipad (Mac Intel). The error appears regardless of which browser I use. I tried Safari, Firefox OS and Chrome OS.

I addition, on Firefox OS and Chrome OS (only when using the iPad!) I get the error message: Unspecified Javascript error) right at the beginning of the experiement before the first routine starts.

I tried to follow the advise in @wakecarter Crip sheet ([PsychoPy Python to Javascript crib sheet - Google Docs](https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit#))  
and edited the index.html file but nothing changes.

When running the experiment on my windows laptop on Chrome everything works perfectly. Even on my Android based tablet on Chrome it works fine.  
Further information: I used PsychoPy Version 2020.2.4 (Builder) for programming.

Can anyone please help me?

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 6, 2021, 10:53am UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/2 "2021-04-06T10:53:55Z")

</div>

Hey! I’ve got two suggestions:

1. Upgrade to the newest PsychoPy; could be that any issue causing this has already been fixed by more recent versions.
2. To get a better idea of where it’s going wrong, take a peek at the browser console. See this tutorial: [tutorial\_js\_semantic\_error [PsychoPy]](https://run.pavlovia.org/tpronk/tutorial_js_semantic_error/)

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 7, 2021, 2:21pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/3 "2021-04-07T14:21:26Z")

</div>

Thank you for your quick reply!!  
I tried your suggestion and upgraded psychopy to the newest version (2021.1.2), but it still shows an error when closing the session on the ipad. I even created a new project so that the changes in the psychopy version were definitely implemented, just to be an the safe side. Also changed line 21 in the index.html file.

Problem with the console.log messages are, that I don’t know what the actual problem is or on which line the bug occurs. So I don’t know, where I should put the console.log line. And I cannot access the Webdeveloper tools on any of the iPad browsers (Safari, Firefox, Chrome) to find out where the bug is. I would need a Mac to be able to get access to it (and I don’t have one).

Super strange thing. Even stranger that this error does not show up on my windows laptop or tablet.

In addition, I cannot download any results from the pavlovia server anymore. Still returns an empty zip folder.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 7, 2021, 3:24pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/4 "2021-04-07T15:24:11Z")

</div>

Ah yeah of course, that goes much harder on iOS than on Android. Let me ask around a bit and get back to you.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 7, 2021, 3:31pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/5 "2021-04-07T15:31:58Z")

</div>

We’re having some trouble accessing your experiment; did you happen to deactivate it?

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 7, 2021, 3:48pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/6 "2021-04-07T15:48:10Z")

</div>

ah yes, so sorry! Forgot to paste the new link here after creating a new project.  
Here it is (still in piloting mode though)

[https://run.pavlovia.org/Rika/masterarbeitsstudie\_bevi\_2021/html/](https://run.pavlovia.org/Rika/masterarbeitsstudie_bevi_2021/html/)

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 7, 2021, 4:43pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/7 "2021-04-07T16:43:07Z")

</div>

I recruited a skilled and well-equipped programmer. Could you share your repo on gitlab with thewhodidthis? I’ll also tag him here: @sotiri

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 7, 2021, 5:26pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/8 "2021-04-07T17:26:44Z")

</div>

Okay great, thanks! I added him as a member with guest permission. 🙂  
@sotiri Or do you need another role permission?

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 7, 2021, 5:38pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/9 "2021-04-07T17:38:49Z")

</div>

Thanks @Rika, could you make it developer access please? As guest I have no access to the actual code 🤓

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 7, 2021, 5:50pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/10 "2021-04-07T17:50:03Z")

</div>

He’ll need at least Developer

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 7, 2021, 5:57pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/11 "2021-04-07T17:57:56Z")

</div>

Done 🙂

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 8, 2021, 10:53am UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/12 "2021-04-08T10:53:31Z")

</div>

Hi @Rika, thanks for giving me access to the repo. Sorry, I have no clear answer for you today. The error you are getting is session related, but I see nothing in the code that would point to it being iPad / iOS specific. I need to check with our Pavlovia engineer whether the logs contain any clues as to what the problem is. I can tell there is a bit of custom data adding in your project, would it be possible to send me a minimal working example to run more tests with? Thanks, x

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 8, 2021, 4:20pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/13 "2021-04-08T16:20:07Z")

</div>

Oh wow, okay. Didn’t think this would be so strange and hard to solve. Thank you for your help! Much appreciated!!  
I compiled a minimal working example as best as possible. Should be in the repo, too. It’s called  
“PsychoPy\_BeVi2021\_MA-Studie MinimalWorkingExample”.  
Is there anything else I can add or help you with?

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 13, 2021, 3:49pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/14 "2021-04-13T15:49:45Z")

</div>

@sotiri Just wanted to ask if there are any news or updates yet?  
I kind of need to start collecting data soon and I am wondering, if there is anything I can do to help solve the issue?

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 14, 2021, 3:38pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/15 "2021-04-14T15:38:06Z")

</div>

Hi @Rika, apologies for the late response 😊 Thanks for taking the time to produce a slimmer version of your project for me to look at. It seems to be getting stuck always at the last trial on the iPad for some reason (can provide screen recordings). Maybe that’s a hint as to what is wrong here 🤔 I need to be able to reproduce the problem before I know how to fix it. It might take some more trial and error, but I’ll get there in the end! Sorry, x

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 22, 2021, 10:09am UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/16 "2021-04-22T10:09:23Z")

</div>

Thank you for all your work and effort! Really appreciated! 🙂 😊  
Yeah, that is the same error I get when I use the iPad too. On some iPad browsers (e.g. Firefox OS) I get another error message right at the beginning of the experiment though, so I thought: Maybe there is some issue with closing the session, because I removed the “particiant” field from the Experiment Info Dialog box? Could that cause problems? 🤔

Were you able to find a solution yet? 😇

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 23, 2021, 4:48pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/17 "2021-04-23T16:48:46Z")

</div>

Hi @Rika, no worries at all, keine Sorge! Apologies for the delay 😊 Yes and no, in that I was able to go through the whole study on iPad Safari a few times with no problems. As it turns out, I just had to switch to landscape mode. The _polygonWeiter_ graphic was being cut off the screen is all it was 🤦‍♂️

OK dropping the participant field should be no issue. However, because transmitting the data back to Pavlovia once the project is run can take a few seconds, I wonder if this is just a case of the participant being eager to finish up?

But I’m curious about the Firefox error you’ve encountered as well, would it be possible to send me the details for that, e.g., any browser console logs or screenshots? Thanks, x

---

<div class="post-metadata">

**Author:** ![Rika](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/rika/32/8721_2.png) [@Rika](https://discourse.psychopy.org/u/Rika)\
**Post date:** [April 24, 2021, 10:16am UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/18 "2021-04-24T10:16:34Z")

</div>

Hi @sotiri! No problem, thanks for still being on this 🙂 Yeah landscape mode is necessary, should have mentioned it, sorry 😃 So you could go through the experiment from beginning to end on an iPad without problem? The dialog box with the green heading showed up and there was no error message at all? Maybe the problem is then with my iPad and not an overall iPad problem at all… 🤔

I don’t think the errors occurs because the session is closed to fastly by me/ the participant. The closing session error occurs once I click on the last polygonWeiter button and then the dialog info appears with the orange heading. The heading never turns to green though, instead the error message (picture 1) appears directly followed by a table of the results in the browser tab (picture 2):  
picture 1:

 ![0406C180-AB76-44CB-9751-4808CED951C0](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/4/e49b4066776eba6a37cfcbcf5184a5acedf04fcf.png)

picture 2:

 ![920A6F2B-34F4-4B0B-B20F-E2ABCCFBCBA0](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/8/4/84ba4b0268796eab3b1d0ee18dbec4e67898b7de.png)

The firefox error occurs directly after initialising the experiment in the Firefox OS browser (again, only on my iPad). Right before and right after the info dialog box appears, an error message shows up. The first disappears directly on its own and is followed by the info dialog box (see the very short video clip and ignore the background noise please 😁). Once I enter all the informations and click on “continue”, the error message appears again, but this time it stays until I click on “ok” and then I can just continue to go through the experiment as normal (picture 3).

[https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/f/2/f2b0e0a09af4d0aca9d849c84d42481c8e00ec58.mp4](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/f/2/f2b0e0a09af4d0aca9d849c84d42481c8e00ec58.mp4)
  
picture 3:  
 ![DCD1C38D-091A-407A-92C3-73C6F473D582](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/6/0/6003b4c4235cdc50b3f8ef2f44b8407c2cb830bd.png)

Since I don’t have access to any developer tools on the iPad, I cannot see what exactly the problem is.

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 26, 2021, 4:25pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/19 "2021-04-26T16:25:23Z")

</div>

Hi @Rika, oh I see, alright, massive thanks for all the information, that helps tons! OK the “blob:” bit in the address bar is telling me that instead of posting the data back to the server, the browser is trying to display the results inline, interesting! But it looks Firefox specific as does the “boot time” error you have documented. Alright, let me run a few more tests, thanks again for your patience and debugging cooperation, more soon, x

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 30, 2021, 4:10pm UTC](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042/20 "2021-04-30T16:10:30Z")

</div>

Hi @Rika, OK this was a bit of a pain to debug, because Firefox offers no developer tools on iOS, apologies again for the delay. As it happens, the problem is with the [log4javascript.js](http://log4javascript.org/) library that PsychoJS relies on under the hood for logging, the `getLogger()` method in particular. One would have hoped that upgrading to the latest version might automagically take care of things, but it looks like there is something specific about iOS Firefox that is [making it trip](https://run.pavlovia.org/support/masterarbeitsstudie_bevi_2021/html/logger.html) 👎

Unfortunately, because of how tightly coupled PsychoJS and Pavlovia are with _log4javascript_, it would be impossible to address the issue without a major refactor 🙄 I completely respect how privacy concerns might make iOS Firefox a great choice for everyday use, but in terms of running your study is there any harm instructing your participants to avoid it? According to Wikipedia it only seems to cover [between 0.31 and 0.70% of the market](https://en.wikipedia.org/wiki/Usage_share_of_web_browsers) across all mobile devices! We may at some point consider making changes to our logging system, but I have no idea how soon, x

[Next page](https://discourse.psychopy.org/t/unspecified-javascript-error-error-closing-session/22042.md?page=2)
