“Unexpected error” thrown when using UrlFetch [duplicate]

扶醉桌前 提交于 2020-12-26 09:44:09

问题


I have been using App Scripts to Download and insert CM360 reports into Google Sheets for a while now, but since a couple of days back I get the following error when running the code:

Exception: Unexpected error: https://www.googleapis.com/dfareporting/v3.4/reports/xxx/files/xxx?alt=media (Code:23:56)

Example of the code I am running:

function runreport() {
var reportId = xxx;
var profileId = xxx;
var additionalParameters = {'synchronous': 'true'};

var ReportFile = DoubleClickCampaigns.Reports.Files.list(profileId,reportId);
var ReportFileID = (ReportFile.items[0].id);
var newReportFile = DoubleClickCampaigns.Files.get(reportId, ReportFileID);

if(newReportFile.urls) {var httpOptions = {'headers': {'Authorization':'Bearer ' + ScriptApp.getOAuthToken()}};
var csvContent = UrlFetchApp.fetch(newReportFile.urls.apiUrl, httpOptions).getContentText();
var csvData = Utilities.parseCsv(csvContent);}}

Do anyone else encountered this issue and have managed to solve it?


回答1:


The unexpected error is due to a new bug with UrlFetchApp

It has already been filed serveral times, e.g. here.

So instead of filing it again you should rather "star" the already existing issue - to increase its visibility.



来源:https://stackoverflow.com/questions/65247137/unexpected-error-thrown-when-using-urlfetch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!