The debugger in Google Apps Script freezes when attempting to debug a particular string

I'm facing a perplexing bug that has me stumped.

Here's the troublesome code snippet:

function testDoubleQuote() {
  var xmlString = '<file><text>Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. &lt;br /&>&lt;br /&gt;Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.</text></file>';
  var xml = XmlService.parse(xmlString);
  var content = xml.getAllContent();
  var text = content[0].getValue();
  console.log(text);
}

While trying to extract the value using getValue(), GAS gets stuck. Even other methods to retrieve the text don't seem to work properly. Strangely, removing either ï, “ or ” from the string makes it work. Removing any two characters also solves the issue. What could be causing this? Is there a character limit? Or maybe something else is at play here? The debugger just hangs.

I have a script that successfully converts the XML object into a JavaScript object. However, whenever I try to access the text content of the object, the debugger keeps loading indefinitely. While stepping through the code, it hangs on getValue() or getText() or getChildText(name) when trying to fetch that specific text value. It seems like the creation of the object completes, but the functions for those specific values never return, likely due to the asynchronous nature of GAS, which is somehow overlooked.

No matter how much I try, I can't gather more insights from GAS about this issue. Could this be related to XmlService.parse()?

Answer №1

function testDoubleQuote() {
  var xmlString = '<file><text>Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. &lt;br /&gt;&lt;br /&gt;Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.</text></file>';
  var xml = XmlService.parse(xmlString);
  var content = xml.getAllContent();
  //Logger.log(content.length);
  var text = content[0].getValue();
  Logger.log(text);
}

Execution log
2:10:41 PM  Notice  Execution started
2:10:42 PM  Info    Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. <br /><br />Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.
2:10:42 PM  Notice  Execution completed

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

CKFinder Error: Unable to find definition for t.event.special.swipe

Upon using CKFinder 3.2.0 with Firefox 44.0, I encountered the following error message. Interestingly, this issue is exclusive to Firefox while Chrome works perfectly fine. Any insights on what could be causing this problem and how it can be resolved? Ty ...

Guide to showing a preview of an image prior to submitting a form using vue.js

I created a Vue form but I'm having trouble making the image preview function work when users try to submit an image to the form. After refreshing the page, I can see the image, but when uploading it, the preview link is broken. There is an option to ...

How can I replicate the functionality of a div mimicking a select element using javascript upon clicking away from the element?

My task was to design a pseudo-select element that showcases columns for each row within the select. Due to HTML's restriction on allowing the <option> tag to include HTML, I had to find an alternate solution. One issue I encountered was replic ...

Prevent incorrect data input by users - Enhancing JavaScript IP address validation

I have been trying to create a masked input field for entering IP addresses, but every solution I come across seems to have some flaws. The best solution I found so far is , but it still allows values higher than 255 to be entered. It works fine initially ...

Setting up NestJs with TypeORM by utilizing environment files

In my setup, I have two different .env files named dev.env and staging.env. My database ORM is typeorm. I am seeking guidance on how to configure typeorm to read the appropriate config file whenever I launch the application. Currently, I am encountering ...

Angular 1.5 component using HTTP GET

Trying to utilize a 1.5 component with AngularJS has presented some challenges for me. I have a service that fetches my JSON file using $HTTP and returns a promise. In the controller of my component, I resolve the promise and assign it to a value using thi ...

Discover how to access the rotation of an object within ThreeJS based on

Currently in my code, I have implemented rotation restrictions around a specific axis using the following snippet: if (obj.rotation.x > -0.5) { // execute rotation } Initially, this setup worked perfectly. However, things took a turn when I introd ...

Manipulate Images Efficiently with jQuery

Are there any jQuery plugins or JavaScript controls available that can display an array of images, with the option to delete an image based on user action? For example, something similar to this: , but with a dedicated delete button on each image. One ad ...

What is the process of displaying text within a link?

I have a basic webpage where I want the text to display from a link. Here is my website: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Encyclopedia</title> <link href="test.css" re ...

arranging a collection of images based on their values in increasing order

cardShop is a container with various images, each with its own unique ID and value attribute. These values consist of two numbers separated by a comma, such as 2000,500 or 1500,200. My goal is to sort these images in ascending order based on the first numb ...

Is it possible to modify the location of my CSG object prior to performing subtraction in Threejs with ThreeCSG?

Looking to carve out specific "voids" in platforms using ThreeCSG. The goal is to have these voids positioned at particular locations on the larger platform. var geometry = new THREE.CubeGeometry( 500, 10, 500 ); var hole_geometry = new THREE.CubeGeom ...

Modify the index in the creation of a json

I am trying to create a JSON object using the code below: var myJSONObject = []; var id = "1", value = "I'm a value !"; myJSONObject.push({id:value}); When I display this construction, it shows: [{"id":"I'm a value !"}] However, I want it to d ...

Exploring angularjs and the concept of variable scoping in relation to

Struggling with variable binding in my angularjs/javascript code for uploading images. Can someone help me out? Here is the snippet of my code: var image_source; $scope.uploadedFile = function(element) { reader.onload = function(event) { image_sourc ...

What could be causing my click() function to only work properly after resizing?

It's driving me crazy. The code snippet below works perfectly, but not in my project. Only the code in the resize() function seems to work. When I resize the window, everything functions as expected - I can add and remove the 'open' class by ...

Error encountered in Listings#index with ExecJS RuntimeError

Upon launching my localhost, I encountered an ExecJS error message that has left me puzzled. Any assistance would be greatly appreciated. A Glimpse into My Localhost The issue originates from /.../conektec/app/views/layouts/application.html.erb, specific ...

What is the best way to prevent code execution until a value is returned by $.get?

My attempt to read data from a file and store it in an array using jQuery's get function has hit a snag. Since the get function is asynchronous, the code that comes after the $.get call runs before the data is defined. How can I make sure that the cod ...

Tips for effectively utilizing the display: inline property in conjunction with ng-repeat

I am struggling to create a timeline with a broken structure on my website. I suspect that the issue lies in using display:inline. When attempting to apply this to my site: https://i.stack.imgur.com/4Ur7k.png the layout gets distorted: https://i.stack.i ...

Adjust the Appearance of Highcharts Legend Post-Rendering

After a Highchart is rendered, is it possible to modify the display settings without redrawing the chart? For instance, I would like to relocate the legend box from the right to the bottom upon screen resize, as illustrated in this image: --Example Pictur ...

Combine the content from multiple text areas and submit it to another text area

****UPDATE**** Thanks to @JasonB, I was able to resolve the previous issue mentioned. Now, I have three additional textareas on the same form that should only appear when their respective checkboxes are clicked. How can I integrate this into my current sc ...

Unexpected error when using Slack SDK's `client.conversations.open()` function: "User Not Found"

I am currently utilizing the Slack node SDK in an attempt to send private messages through a bot using user IDs: const client = new WebClient(process.env.SLACK_TOKEN); const sendMessage = async (userId) => { try { await client.conversations.open( ...