JS and sync to pavlovia

I am currently experiencing a serious technical issue with my experiment. Although my experiment runs smoothly and without any problems locally in PsychoPy, it consistently fails to run on Pavlovia after syncing. Here is a detailed description of the problem:

When I try to run the experiment on Pavlovia, I receive the following error message:

Unfortunately we encountered the following error:
TypeError: tt().i18n.detectLanguage is not a function. (In ‘tt().i18n.detectLanguage(c)’, ‘tt().i18n.detectLanguage’ is undefined)**
Try to run the experiment again. If the error persists, contact the experiment designer.

Additionally, I am sometimes encountering a 403 Forbidden error.
When I check the synced project files on Pavlovia, I notice that the index.html file is completely empty after syncing. No proper HTML structure appears.
To solve the issue, I have already tried multiple steps:
I downgraded PsychoPy to version v2024.1.0 , but the problem persisted.
I then upgraded back to v2024.2.4, but still encountered the same error.
I manually edited the JavaScript files and created a custom index.html file myself.
Despite all these efforts and spending several hours troubleshooting, the issue remains unresolved.
To date, I have recreated and rebuilt the entire project from scratch four times , but the same problem keeps occurring.
Also I have only text, sliders, keyboard componant.

I would greatly appreciate it if someone from your technical team could assist me, as I am under significant time pressure and have already invested extensive effort into solving this independently.

Please let me know if you require any additional information, project files, or access to the GitLab repository.

Thank you very much for your time and support.

Kind regards,

Mahsa

That sounds like you are trying to do something that doesn’t work online. What/how does detect language work locally?

Hi,

Thank you so much for your response.

To be honest, I didn’t manually set anything to detect language. I only built my experiment using PsychoPy Builder, and I didn’t add any special JavaScript code for language detection. Locally, the experiment runs perfectly without any errors.

The detectLanguage error only appears when I try to run it online on Pavlovia after syncing.

Do you think it might be something built automatically into the version of PsychoJS I am using (v2024.2.4)?
I would really appreciate any advice on how I can fix or bypass this issue.

Thank you again

That version should be fine. I haven’t come across that error before so something must be unusual with your setup or code.

Have a look at these tips.

Hi,

Thank you so much for taking the time to reply and explain things clearly.

I really appreciate it.

I just wanted to update you that I checked my .psyexp file carefully, and I can confirm that I have not used any code components.

Everything was created using standard Builder components (Text, Keyboard, Loops, Sliders, etc.), and the experiment runs perfectly offline inside PsychoPy.

However, when I try to Sync the project to Pavlovia, the index.html file is either missing or empty, and I get this error when trying to run it online:

“Unfortunately we encountered the following error:

TypeError: tt().i18n.detectLanguage is not a function.”

I also receive an Error 403 sometimes.

To fix this, I tried everything I could:

• I downgraded PsychoPy to version 2024.1.0 (didn’t help),

• Then I upgraded to version 2024.2.4 again,

• I manually edited the JavaScript files,

• I rebuilt the experiment 6 times from scratch but the issue persists.

At this point, I am extremely stressed because I have deadlines and other assignments to complete as well.

Would you have any suggestions on what I could do next?

Could it be something wrong with the way the HTML files are generated? Or a sync issue?

I would really appreciate any advice or guidance you could offer.

Thank you again for your patience and help.

Best regards,

Mahsa

Try looking at your locale setting in File/Preferences/Application

You could change it to something like en_US if it is set to system locale. Perhaps your system has a language setting PsychoPy doesn’t recognise.

Please could you post the full traceback of the error message? Is it in the Runner window when you try to sync?

Thank you again for your help.

Here is the full error message I get when trying to run the experiment online on Pavlovia:

Unfortunately we encountered the following error:

TypeError: tt().i18n.detectLanguage is not a function.

(In ‘tt().i18n.detectLanguage(c)’, ‘tt().i18n.detectLanguage’ is undefined)

Additionally, sometimes I get a 403 Error when trying to sync.

When I run the experiment locally inside PsychoPy (in Runner window), there are no errors at all. Everything works perfectly on my computer.

The problem happens only after syncing to Pavlovia:

• The index.html file is either empty or corrupted,

• And when opening the experiment online, I get the TypeError above.

I also checked the locale settings as you suggested. It was set to “system locale”, so I changed it manually to “en_US” and restarted PsychoPy. However, unfortunately the same problem persists.

Thanks again.

If the error is displayed in the browser, then please could I have more information from there?

Hi,
I opened the console as you suggested. The main error that appears is:



sorry for sending them like this , it only aloows me to send 2 pictures at a time.



Hi @mahsa123,

What happens if you try running your experiment in Google Chrome rather than Safari? Are you able to run other experiments in Pavlovia, like this Stroop demo?

Hi, unfortunately I’m unable to run any other online experiments on Pavlovia either.
The error I’m encountering is the same as the one that appeared in the Stroop experiment you sent me.

I logged into Pavlovia using Google Chrome. The test started running, but then I encountered this error:
ReferenceError: BISS_TESTCLOCK is not defined.

To try to fix it, I removed all start times (from 0.0 to blank) in both the text component and my slider and keyboard. I’ve also double-checked, and BISS_TESTCLOCK doesn’t appear anywhere in my entire experiment.

Could you please help me resolve this issue?

Hi @mahsa123,

Are you able to run the Stroop demo I linked before on Google Chrome? I’m asking so I can help determine if this is a general browser/computer settings issue or something directly related to your experiment.

If you’re able to share your experiment so I can test it, that would be great.

MM_stroop1.psyexp (60.9 KB)

Thanks, and are you able to run the Stroop demo I linked before in Google Chrome?