问题描述
我在 Google Cloud AI Platform 上部署了一个模型 (TensorFlow),并在通过 Firebase 帐户部署 node.js 后尝试从 Cloud Function 获得预测。错误说:
Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging Details: Permission denied on resource project skinskanproject-capstone.
这里是日志的详细信息:
Error: Permission denied on resource project skinskanproject-capstone. at Gaxios._request (/workspace/node_modules/gaxios/build/src/gaxios.js:127:23) at processticksAndRejections (internal/process/task_queues.js:97:5) at async Compute.requestAsync (/workspace/node_modules/google-auth-library/build/src/auth/oauth2client.js:343:18) at async /workspace/lib/index.js:26:19
这是 node.js 代码:
import * as functions from 'firebase-functions';
import { google } from 'googleapis';
const ml = google.ml('v1')
export const predictCancer = functions.https.onRequest(async (request,response) => {
const instances = request.body.instances;
const model = request.body.model;
const { credential } = await google.auth.getApplicationDefault();
const modelName = `projects/skinskanproject-capstone/models/${model}`;
const preds = await ml.projects.predict({
auth: credential,name: modelName,requestBody: {
instances
}
} as any);
response.send(JSON.stringify(preds.data))
});
是否遗漏了任何 IAM 设置或身份验证步骤?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)