亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

谷歌函數:TypeError:無法讀取未定義的屬性“名稱”

谷歌函數:TypeError:無法讀取未定義的屬性“名稱”

飲歌長嘯 2021-06-15 17:05:20
我正在嘗試使用 Google 云功能將視頻從存儲桶轉碼,并使用在線發布的代碼輸出到另一個存儲桶,但進行了一些調整。但我收到以下錯誤:類型錯誤:無法讀取在 transcodeVideo (/srv/index.js:17:56) at /worker/worker.js:825:24 at at process._tickDomainCallback (internal/process/next_tick.js:229) 處未定義的屬性“名稱” :7)索引.jsconst {Storage} = require('@google-cloud/storage');const projectId = 'cc18-223318';const storage = new Storage({    projectId: projectId,});const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;const ffmpeg = require('fluent-ffmpeg');const transcodedBucket = storage.bucket('2400p');const uploadBucket = storage.bucket('inpuut');ffmpeg.setFfmpegPath(ffmpegPath);exports.transcodeVideo = function transcodeVideo(event, callback) {  const file = event.data;  // Ensure that you only proceed if the file is newly created, and exists.  if (file.metageneration !== '1' || file.resourceState !== 'exists') {    callback();    return;  }  // Open write stream to new bucket, modify the filename as needed.  const remoteWriteStream = transcodedBucket.file(file.name.replace('.webm', '.mp4'))    .createWriteStream({      metadata: {        metadata: file.metadata, // You may not need this, my uploads have associated metadata        contentType: 'video/mp4', // This could be whatever else you are transcoding to      },    });  // Open read stream to our uploaded file  const remoteReadStream = uploadBucket.file(file.name).createReadStream();
查看完整描述

1 回答

?
繁星coding

TA貢獻1797條經驗 獲得超4個贊

函數 transcodeVideo 使用參數(事件、回調)獲取文件數據的問題。這些參數(事件和回調)根據本文檔用于 Node.js 6 ,對于Node.js 8/10,您應該使用(數據和上下文)。請使用命令檢查 Node.js 版本node -v,或者只是在控制臺的 Cloud Function 部分檢查它。解決方案是安裝舊的 Node.js 6 版本或編輯與 Node.js 8/10 兼容的代碼。


查看完整回答
反對 回復 2021-06-24
  • 1 回答
  • 0 關注
  • 244 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號