Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script Google Sheets Webhooks在1周后停止工作_Google Apps Script_Google Sheets_Web Applications_Webhooks - Fatal编程技术网

Google apps script Google Sheets Webhooks在1周后停止工作

Google apps script Google Sheets Webhooks在1周后停止工作,google-apps-script,google-sheets,web-applications,webhooks,Google Apps Script,Google Sheets,Web Applications,Webhooks,我创建了Webhook,当在我的woocommerce商店中完成订单(或订阅更改)时触发。我做了这项工作,并有一个所有测试更改的表。 现在的一个大问题是,它突然不起作用了,尽管上周我把一切都安排好了,它还是起作用了(直到那时我才改变任何事情)。 附加信息:我总是让来自woocommerce的每一个webhook不仅转到特定的GoogleSheets链接,还转到一个测试环境(在我的例子中是webhook.site),在那里我总是收到所有的webhook。我认为这是一个迹象,表明这个问题不是来自商业

我创建了Webhook,当在我的woocommerce商店中完成订单(或订阅更改)时触发。我做了这项工作,并有一个所有测试更改的表。 现在的一个大问题是,它突然不起作用了,尽管上周我把一切都安排好了,它还是起作用了(直到那时我才改变任何事情)。 附加信息:我总是让来自woocommerce的每一个webhook不仅转到特定的GoogleSheets链接,还转到一个测试环境(在我的例子中是webhook.site),在那里我总是收到所有的webhook。我认为这是一个迹象,表明这个问题不是来自商业。 (是的,我已经检查了好几次谷歌表单的链接是否正确。一周前它们甚至工作得完美无缺)

我粘贴了下面使用的所有代码,而大多数代码只是提取变量值

您是否需要更多的见解来提供帮助

//this is a function that fires when the webapp receives a GET request
function doGet(e) {
  return HtmlService.createHtmlOutput("request received");
}

//this is a function that fires when the webapp receives a POST request

function doPost(e) {
  var myData             = JSON.parse([e.postData.contents]);
  var order_number       = myData.number; 
  var order_status       = myData.status; 
  var order_created      = myData.date_created; 

  var order_modified     = myData.date_modified; 
  var date_paid          = myData.date_paid; 
  var customer_id        = myData.customer_id; 
  var discount_total     = myData.discount_total; 
  var discount_tax       = myData.discount_tax; 
  var shipping_total     = myData.shipping_total; 
  var shipping_tax       = myData.shipping_tax; 
  var total              = myData.total; 

  var billing_first_name = myData.billing.first_name; 
  var billing_last_name  = myData.billing.last_name; 
  var billing_company    = myData.billing.company; 
  var billing_address    = myData.billing.address_1; 
  var billing_city       = myData.billing.city; 
  var billing_postcode   = myData.billing.postcode; 
  var billing_email      = myData.billing.email; 
  var billing_phone      = myData.billing.phone; 

  var shipping_first_name = myData.shipping.first_name; 
  var shipping_last_name  = myData.shipping.last_name; 
  var shipping_company    = myData.shipping.company; 
  var shipping_address    = myData.shipping.address_1; 
  var shipping_city       = myData.shipping.city; 
  var shipping_postcode   = myData.shipping.postcode; 

  var ernaehrungsstil    = myData.line_items[0].meta[0].value; 
  var mahlzeiten_woche   = myData.line_items[0].meta[1].value; 
  var discount_code      = myData.coupon_lines[0].code; 

  var product_name       = myData.line_items[0].name; 
  var product_qty        = myData.line_items[0].quantity; 
  var product_total      = myData.line_items[0].total; 
  var product_total_tax  = myData.line_items[0].total_tax; 
  var payment_method     = myData.payment_method_title; 
  var shipping_method    = myData.shipping_lines[0].method_title; 

  var timestamp = new Date();
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.appendRow([timestamp,order_created,order_modified,date_paid,order_number,customer_id,order_status,product_name,product_qty,ernaehrungsstil,mahlzeiten_woche,payment_method,total,product_total,product_total_tax,discount_total,discount_tax,discount_code,shipping_total,shipping_tax,shipping_method,billing_first_name,billing_last_name,billing_company,billing_address,billing_city,billing_postcode,billing_email,billing_phone,shipping_first_name,shipping_last_name,shipping_company,shipping_address,shipping_city,shipping_postcode]);
}


欢迎请添加更多详细信息,如您的项目正在使用的运行时环境(V8或Rhino)以及执行记录或项目执行页面中记录的错误。您的代码没有明显错误,因此我猜可能是V8/Rhino问题。问题追踪器上有几个上载问题,请尝试切换回Rhino。谢谢Ruben。我检查了运行时环境。它是v8,但在阅读了几周前刚刚推出的v8之后,我禁用了它,并选择了传统版本,再次尝试,但没有结果。检查执行记录和项目执行页面非常奇怪,因为它没有显示任何执行或见解(尽管3月2日它达到了预期的结果)。还有别的吗?嘿,库珀。谢谢你检查代码。我只是在切换回Rhino(现在刚刚命名为legacy)后尝试了一下。切换后我没有得到任何结果,就像我写这个问题时一样。我觉得很困惑,因为它以前工作过。你在日志上有错误吗?执行是否显示在“执行”面板(查看->执行)中?