[英]Firebase hosting deployment error Error: Error: 404, Requested entity was not found
[英]Apps Script projects.deployments.create throwing GaxiosError: Requested entity was not found
我正在嘗試使用 Apps 腳本 API 為 Google 表格設置一個 onEdit 觸發器。我已經設法通過下面給出的代碼創建和更新一個腳本項目(這工作正常)
const createScriptRes = await this.script.projects.create({
requestBody: {
title,
},
})
if (createScriptRes.err) {
responseObj.err = createScriptRes.err
return responseObj
}
const scriptId = createScriptRes.data.scriptId
const updateScriptRes = await this.script.projects.updateContent({
scriptId,
auth: this.auth,
resource: {
files: [
{
name: 'gsheet_trigger',
type: 'SERVER_JS',
source: `
function onEdit(e) {
UrlFetchApp.fetch("http://localhost:3000/webhooks/gsheet", {
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify({ rowInd: e.range.getRowIndex() })
})
}
function setup() {
const sheet = SpreadsheetApp.openById("SHEET_ID")
ScriptApp.newTrigger("onEdit").forSpreadsheet(sheet).onEdit().create()
}
`,
},
{
name: 'appsscript',
type: 'JSON',
source: `{"timeZone":"America/New_York","exceptionLogging": "CLOUD", "executionApi": {
"access": "ANYONE"
}}`,
},
],
},
})
現在,當我嘗試使用以下代碼部署此腳本項目時,我面臨“找不到請求的實體”。
const deployScriptRes = await this.script.projects.deployments.create({
scriptId,
requestBody: {
versionNumber: 1,
manifestFileName: 'appsscript',
},
})
完整的錯誤主體是
errors: [
{
message: 'Requested entity was not found.',
domain: 'global',
reason: 'notFound'
}
]
我已經在文檔、github 問題和 StackOverflow 上尋找解決方案,但沒有找到任何特定於此的內容
嘗試將 requestBody 更改為 resource 並刪除多余的逗號:
const deployScriptRes = await this.script.projects.deployments.create({
scriptId,
resource: {
versionNumber: 1,
manifestFileName: 'appsscript' //remove comma at end
},
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.