Experiment runs offline, not online; reference error, but variable is already defined in begin experiment

URL of experiment: Sign in · GitLab

Description of the problem:
The experiment stops quickly, saying: ReferenceError: msg is not defined

Tried to solve this by:

  • checking the cribsheet: msg is already defined at begin experiment. Its a n-back task, with several sub n-back task, in each feedback part, msg is defined at begin experiment and then used (in the picture under feedback 2, not used in other code under trial and feedback)

  • tried to check what happens in the browser/developer console, but I do not really understand:

ReferenceError: msg is not defined
at Scheduler._currentTask (/sbruijniks/remind_nback/nback_fulltask22.10b%20-%2029.10online.js:1614:20)
at Scheduler._runNextTasks (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:33108)
at async Scheduler._runNextTasks (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:33150)
at async Scheduler._runNextTasks (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:33150)
at async update (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:32204)
window.onunhandledrejection @ /sbruijniks/remind_n…js-2022.2.4.js:1302Understand this errorAI
FATAL 12:38:00.599 _GUI.dialog psychojs-2022.2.4.js:1257 | {}
BrowserConsoleAppender.append @ /sbruijniks/remind_n…chojs-2022.2.4.js:7Understand this errorAI
/sbruijniks/remind_n…29.10online.js:1614 Uncaught (in promise) ReferenceError: msg is not defined
at Scheduler._currentTask (/sbruijniks/remind_nback/nback_fulltask22.10b%20-%2029.10online.js:1614:20)
at Scheduler._runNextTasks (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:33108)
at async Scheduler._runNextTasks (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:33150)
at async Scheduler._runNextTasks (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:33150)
at async update (/sbruijniks/remind_nback/lib/psychojs-2022.2.4.js:1049:32204)Understand this errorAI
remind_nback/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

What to do? Offline the task works.

Your screenshot is of a Python code component. You should change it to Auto if you want it to do anything online.

Thanks for your help!
Stupid mistake, I now did change all code types to ‘‘Auto → JS’’, but still the same error happens…
When I run it on PsychoJS on a local server it works but on Pavlovia it doesn’t (‘‘reference error msg not defined’’)



Does it behave the same in an incognito tab?

no, the task works…
what is happening?

When you synchronise changes to your experiment, you may need to clear your browser cache to see those changes online (using Ctrl-F5, Ctrl-Shift-R or equivalent). If this does not work use an incognito browser tab. A participant will not need to do this, so long as they have not already tried a previous version of your experiment.

https://psychopy.org/online/psychoJSCodingDebugging.html

1 Like

super this was the mistake, many thanks!