Fetcher.fetch() seems to interrupt the execution of the formula without throwing any errors

Dealing with a strange bug that I have isolated to one line of code (an awaited call to an async function), where the log right before the line prints to the Pack maker tools console, but the log right after it does not. I have wrapped the code in a try/catch block, and no errors are thrown. Using the DeleteAction button that runs this code in a doc confirms that it “ran successfully”, with a toast message that “1 external action performed”. I am not exactly sure how it is possible that the execution of the code interrupts (i.e. the console.log statements beneath it do not print anything) without any errors being thrown, so I suspect that the async function call is taking either too long or is somehow not resolving, which causes the Coda runtime to interrupt after a certain amount of time.

Here is the function in question:

The awaited function call is to a simple function to asynchronously get a list of the tasklists:

The output in the console is:

got here 1
  
was not a valid identifier

The weirdest part is that this exact code works flawlessly when called by the code for other formulas and actions, but somehow fails when called by the code for the DeleteTask action.

Hi @loucadufault - Thanks for providing all of that context, it does seem like a tricky issue. Looking at the Pack maker tools, does it show long long the formula ran for? The Packs runtime does have a maximum execution time (currently around 60 seconds, but subject to change) and if you were to hit that your code could be canceled abruptly.

Hi Eric, thanks for reviewing the issue.

The pack maker tools show that the action completes in around 700ms (visually it seems to complete in a second or two as well). Nowhere near the 60s limit so I suppose that is not the issue?

I have further isolated the issue to the line where I get the initial response in the async function returned by listTasklists, so line 17 in the original post.

Surrounding it with a try/catch and adding logging above below again only prints the log above it (and no errors). Specifically, this debugging code:

Gives these logs in the console:

  called async function with fetcher arg and got promise result
  about to fetcher.fetch()
  { url: 'https://www.googleapis.com/tasks/v1/users/@me/lists?maxResults=100' }
  called listTasklists() and got async function
  got here 1
  ...

Odd indeed. Were you able to trace this down to a specific line of code? If not, would you be willing to share the code with me, or ideally a simpler version that still repros the issue?