Google Apps脚本:很抱歉,发生服务器错误。请稍等,然后重试 [英] Google Apps Script: We're sorry, a server error occurred. Please wait a bit and try again

查看:254
本文介绍了Google Apps脚本:很抱歉,发生服务器错误。请稍等,然后重试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了341条错误通知电子邮件,其中包含以下错误消息:


很抱歉,发生服务器错误。请稍等,然后重试。


通知电子邮件只会告知发生问题的函数的名称。



脚本现在没有运行。任何试图在脚本中运行任何函数都会导致上述错误。此外,我使用脚本添加到电子表格中的自定义菜单消失了。我发现没有办法调试脚本,因为脚本上的每个动作都给了我上述错误。



编辑



以下是出错的函数

 函数crunchEmails(){
var sheet = SpreadsheetApp.getActiveSheet();
var gLabel = sheet.getRange(gmailLabel)。getValues();


//检查当前SpreadSheet的限制,并创建一个
//新的SpreadSheet,如果限制接近
checkSpreadSheet();


var gFolder = sheet.getRange(outputFolderName)。getValues();
var gSpreadSheetName = sheet.getRange(outputSpreadsheetPrefix)。getValues();
var threadsPerSearch = sheet.getRange(threadsPerSearch)。getValues();

//每次搜索的电子邮件数量:
var threads = GmailApp.search( - label:+ gLabel,0,threadsPerSearch);

for(var x = 0; x
var messages = threads [x] .getMessages();

//获取null ...没有消息的线程很奇怪
if(messages!= null){
for(var y = 0; y< messages.length; y ++){

updateSpreadSheet(messages [y]);




GmailApp.getUserLabelByName(gLabel).addToThread(threads [x]);


我陷入了无处不在,没有线索为什么会发生这种情况?



任何人都可以请指导解决问题吗? / div>

解决问题。

问题是在其他函数中使用字符串替换函数。我正在使用带正则表达式的字符串替换函数作为替换函数的输入。正则表达式是不正确的,因为我得到上述错误。

真的很奇怪,至少GAS应该给出一些适当的错误。

I have received 341 error notification emails for the below error

We're sorry, a server error occurred. Please wait a bit and try again.

The notification email only tells about the name of function in which the issue is occurring.

The script is not running now. Any try to run any function in the script gave the above error. Also my custom menu that i have added into the Spreadsheet using the script is gone. I found no way to debug the script as every action on the script giving me the above error.

EDIT

Below is the function in which error is coming

function crunchEmails() {
  var sheet   = SpreadsheetApp.getActiveSheet();
  var gLabel  = sheet.getRange("gmailLabel").getValues();


  // check the current SpreadSheet for limits and create a 
  // new SpreadSheet if limits are approaching
  checkSpreadSheet();


  var gFolder = sheet.getRange("outputFolderName").getValues();
  var gSpreadSheetName = sheet.getRange("outputSpreadsheetPrefix").getValues();
  var threadsPerSearch  = sheet.getRange("threadsPerSearch").getValues(); 

  // Number of emails per search:
  var threads = GmailApp.search("-label:" + gLabel, 0, threadsPerSearch); 

  for (var x=0; x<threads.length; x++) {

    var messages = threads[x].getMessages();

    // getting null...a thread without messages is weird
    if(messages != null) {
     for (var y=0; y<messages.length; y++) {

        updateSpreadSheet(messages[y]);

      }
    }

    GmailApp.getUserLabelByName(gLabel).addToThread(threads[x]);
  }
}

I am stuck in the middle of nowhere, have no clue about why this is happening?

Could anyone please guide to resolve the issue?

解决方案

Problem Solved.

The problem is with string replace function in some other function. I am using the string replace function with regular expression as input to replace function. The regular expression was incorrect due which i am getting the above error.

That's really weird, at least GAS should give some proper error.

这篇关于Google Apps脚本:很抱歉,发生服务器错误。请稍等,然后重试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆