使用 Cloud Vision API 以及 Cloud Video Intelligence 來分析用戶上傳的影像內容
https://google.qwiklabs.com/focuses/1831?parent=catalog
在做 qwiklabs 根據 lab的指令操作後,發現
google3609255_student@cloudshell:~/cloud-functions-intelligentcontent-nodejs (qwiklabs-gcp-56342179dc58c899)$ gcloud beta functions logs read --filter "finished with status" "GCStoPubsub" --limit 100
LEVEL NAME EXECUTION_ID TIME_UTC LOG
D GCStoPubsub 571422046135796 2019-06-05 08:35:31.877 Function execution took 73 ms, finished with status: 'error'
D GCStoPubsub 571421205316066 2019-06-05 08:35:32.077 Function execution took 8 ms, finished with status: 'error'
D GCStoPubsub 571414323826018 2019-06-05 08:35:32.094 Function execution took 6 ms, finished with status: 'error'
D GCStoPubsub 571419485944406 2019-06-05 08:35:34.640 Function execution took 6 ms, finished with status: 'error'
D GCStoPubsub 571415488973213 2019-06-05 08:37:52.756 Function execution took 15 ms, finished with status: 'error'
D GCStoPubsub 571417544723965 2019-06-05 08:38:37.874 Function execution took 6 ms, finished with status: 'error'
D GCStoPubsub 571415849379992 2019-06-05 08:40:39.910 Function execution took 126 ms, finished with status: 'error'
D GCStoPubsub 571419849882328 2019-06-05 08:48:21.880 Function execution took 51 ms, finished with status: 'error'
D GCStoPubsub 571423516556082 2019-06-05 08:55:36.767 Function execution took 8 ms, finished with status: 'error'
D GCStoPubsub 571429569637960 2019-06-05 08:55:46.435 Function execution took 10 ms, finished with status: 'error'
查看 cloud function 的 Log
GCStoPubsub
571423516556082
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at Function.Buffer.from (buffer.js:183:11) at GCStoPubsub (/srv/index.js:55:27) at /worker/worker.js:825:24 at <anonymous> at process._tickDomainCallback (internal/process/next_tick.js:229:7)
手冊中 Deploy cloud function runtime 部份是使用 nodejs8
gcloud beta functions deploy GCStoPubsub --runtime nodejs8 --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic ${UPLOAD_NOTIFICATION_TOPIC} --entry-point GCStoPubsub
範例的程式碼應該是使用 nodejs6
改用 nodejs6 deploy 所有的 cloud function
gcloud beta functions deploy GCStoPubsub --runtime nodejs6 --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic ${UPLOAD_NOTIFICATION_TOPIC} --entry-point GCStoPubsub
佈署完後再上傳一張圖片
google3609255_student@cloudshell:~/cloud-functions-intelligentcontent-nodejs (qwiklabs-gcp-56342179dc58c899)$ gcloud beta functions logs read --filter "finished with status" "GCStoPubsub" --limit 100
LEVEL NAME EXECUTION_ID TIME_UTC LOG
D GCStoPubsub 571422046135796 2019-06-05 08:35:31.877 Function execution took 73 ms, finished with status: 'error'
D GCStoPubsub 571421205316066 2019-06-05 08:35:32.077 Function execution took 8 ms, finished with status: 'error'
D GCStoPubsub 571414323826018 2019-06-05 08:35:32.094 Function execution took 6 ms, finished with status: 'error'
D GCStoPubsub 571419485944406 2019-06-05 08:35:34.640 Function execution took 6 ms, finished with status: 'error'
D GCStoPubsub 571415488973213 2019-06-05 08:37:52.756 Function execution took 15 ms, finished with status: 'error'
D GCStoPubsub 571417544723965 2019-06-05 08:38:37.874 Function execution took 6 ms, finished with status: 'error'
D GCStoPubsub 571415849379992 2019-06-05 08:40:39.910 Function execution took 126 ms, finished with status: 'error'
D GCStoPubsub 571419849882328 2019-06-05 08:48:21.880 Function execution took 51 ms, finished with status: 'error'
D GCStoPubsub 571423516556082 2019-06-05 08:55:36.767 Function execution took 8 ms, finished with status: 'error'
D GCStoPubsub 571429569637960 2019-06-05 08:55:46.435 Function execution took 10 ms, finished with status: 'error'
D GCStoPubsub 571427211397985 2019-06-05 09:11:41.347 Function execution took 1622 ms, finished with status: 'ok'
google3609255_student@cloudshell:~/cloud-functions-intelligentcontent-nodejs (qwiklabs-gcp-56342179dc58c899)$
沒有留言:
張貼留言