深入调试UrlFetchApp.fetch()吗?返回-“地址不可用”

时间:2018-08-31 09:51:54

标签: api google-apps-script google-sheets

编辑- !!!查看答案以获取答案,这不是问题!!!

在Google表格内编写脚本期间尝试从API提取数据失败,错误为const arr=[{_id:'5b8906e81248270685399a9a',name:'fin24',state:'OK',status:!0,},{_id:'5b8907031248270685399a9b',name:'news24',state:'OK',status:!0,}]; const feedArticlesCount=[{_id:'5b8907031248270685399a9b',pending:21,approved:1,active:21,inactive:1},{_id:'5b8906e81248270685399a9a',pending:20,approved:0,active:20,inactive:0},{_id:'5b8664c26d90b107d0952cbe',pending:62,approved:8,active:0,inactive:70},{_id:'5b865bf28152610775987d67',pending:111,approved:30,active:0,inactive:141}] const articlesById = feedArticlesCount.reduce((a, { _id, ...rest }) => { a[_id] = rest; return a; }, {}); console.log(arr.map( ({ _id, ...rest }) => ({ _id, ...rest, ...articlesById[_id] }) ));-但是,我可以通过邮递员使用完全相同的请求成功地从端点检索数据。

我尝试将Address unavailable: https://url.com/api/endpoint添加到标题中,但是它没有返回任何额外的细节。无论如何,有什么方法可以更准确地找到它在什么时候失败了?

当用户单击通过应用程序脚本添加到电子表格的“运行导入程序”按钮时,将发送请求。相关代码段如下:

muteHttpExceptions: true

收到错误-错误:异常:地址不可用:https://url.com/api/endpoint

1 个答案:

答案 0 :(得分:1)

等等,我是个白痴。我完全忘记了我试图访问的URL已被锁定为一组IP,因为该应用程序在Google服务器上运行,因此永远无法到达该API。