
We have online training that is built using Articulate Storyline and we then package and send to our website host to publish. This was built like 10 years ago and the build is no longer supported. The Apps script that sends the results to a Google sheet is no longer working due to the change to V8.I have only just got access to the script and have no idea what needs changing to convert it from Rhino to V8 compatibility.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/c8b9a9bd-8473-4d92-afd9-2f6ae19f79aen%40googlegroups.com.
Toggle the runtime directly in the Apps Script editor:
Open your Apps Script project.
Click on Project Settings (the gear icon on the left sidebar).
Check the box that says Enable Chrome V8 runtime
There are a few changes that might cause your script to throw errors
1. Extraneous Comma in Object LiteralsRhino ignored trailing commas in object definitions; V8 will throw a syntax error.
🛑 Rhino (Broken in V8): var obj = { a: 1, b: 2, };
V8 (Fixed): const obj = { a: 1, b: 2 };
In Rhino, var had function-level scope. V8 introduces block-scoping. If you start swapping var for let or const, make sure you aren't trying to call a variable outside of the {} block it was defined in.
3. Logger.log() FormattingIn Rhino, Logger.log() allowed SQL-style formatting string inputs (like %s). V8 prefers standard string concatenation or, better yet, modern template literals.
🛑 Rhino: Logger.log("User %s logged in", username);
V8: Logger.log(\User ${username} logged in`);`
V8 is much stricter about modifying built-in prototypes. If your script alters standard objects (like adding custom methods directly to Array.prototype), it might behave unexpectedly or throw errors.
Are you encountering a specific error message after turning on V8, or would you like me to review a specific piece of your script for compatibility?
I can certainly help you update this script!
The main reason your script is failing in the V8 runtime isn't actually V8 itself, but rather a few deprecated Google Apps Script methods and older JavaScript habits that the old Rhino runtime ignored but V8 enforces.
Here are the main fixes made in the updated code below:
LockService.getPublicLock() is deprecated: Google replaced this with getScriptLock(). This is almost certainly what is causing your execution error.
Variable Shadowing: Your main function is handleResponse(e) but your error catcher is catch(e). Using the same variable name e for both causes conflicts in modern JavaScript. I changed the error variable to err.
Array Iteration: Using for (i in headers) is discouraged for arrays in modern JavaScript (ES6/V8) and can cause unexpected bugs. I updated this to a standard for loop.
Modern Syntax: Updated var to const and let for better memory management and strictness in V8.
Because this acts as a Web App, simply saving the script will not apply your changes to the live URL. You must re-publish it:
In the Apps Script editor, click Deploy > New deployment (or "Manage deployments" -> Edit -> New Version).
Ensure it is set to Execute as: Me and Who has access: Anyone.
Click Deploy. (Your Web App URL should remain the same if you edit an existing deployment, but ensure you test with the new version).
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/f64d4497-9539-45e3-a875-7c3fd0567709n%40googlegroups.com.