Additional } inserted when syncing with Pavlovia

URL of experiment:
https://run.pavlovia.org/donnabryce/lafig_mathpilotwebcam
Description of the problem:
I am using PsychoPy v 2023.2.2. Recently, when I want to sync a new project with Pavlovia, I get stuck on the initialising screen and when I investigate further it is because additional }'s have been added to the JavaScript file. I get the following message in the Console: Uncaught SyntaxError: unexpected garbage after module, starting with ‘}’. This is somewhat helpful, as it tells me where to look in the JS file to correct it, but then I have to do this manually every time I make a change in the experiment. In the experiment linked above, there are three such additional }'s and when I correct them I start getting error messages that the variables currentLoop and frameDur are undefined… I have checked in my Code Components and I cannot see any additional }'s in there, which is why I think these are inserted during the compilation of the JS file.
Can anyone help me? Could this be a bug in the newest version of PsychoPy?
Thank you!

Hello

Are you using code components in your experiment? There may be some code left over from previous versions of your experiment.

I “had” some unwanted “leftover JavaScript code” in a Python-only code component. I had used this code component to write some JavaScript using Builder’s auto-translate feature. I copied the auto-translated JavaScript code into a JavaScript-only code component. I then set the auto-translated code component to Python only. However, the JavaScript code from the Python-only component still got added to the JavaScript file, messing it up. Setting the Python-only code component to both and explicitly deleting the JavaScript code solved the problem.

Best wishes Jens

Hi Jens,
Thanks for taking the time to respond. Unfortunately this didn’t help. I deleted all the (old, not needed) contents from the Python side of the code components, just to be sure. But as far as I understand they shouldn’t be involved in generating the JS file anyway. I also played around with the order that the components are entered within the Routine (in Builder view) but this didn’t solve the problem either.
Best,
Donna

The problem is resolved (for now!). I noticed that it seemed to be the new Camera components I had added that were causing a problem, and on doing some more searching I realised that Camera components need a Duration to be entered (see: Camera Component — PsychoPy v2023.2.3). When I entered a duration for Camera the experiment runs again. However, I had also faced this problem with additional }'s when I didn’t have Camera components, so I wonder if some other components also need a duration to be entered? If anyone faces a similar problem, this might be something to check.

Hello

congratulations. I either have a duration for a component or, at least, add an expected duration.

Best wishes Jens