AutoML自然语言Node.js API调用给出“错误的base64解码”错误

时间:2018-09-13 23:49:33

标签: javascript node.js google-cloud-platform automl google-cloud-automl

我正在将Google的AutoML自然语言API用于Node.js。除了特定的服务帐户和用户(我的学生)以外,其他所有功能都可以正常运行。她收到以下错误:

  

验证错误:错误:错误:0906D064:PEM例程:PEM_read_bio:错误的base64解码   {错误:14无法使用:从插件获取元数据失败,并显示错误:错误:0906D064:PEM例程:PEM_read_bio:错误的base64解码       在Object.exports.createStatusError(/home/ubuntu/workspace/functions/node_modules/grpc/src/common.js:87:15)       在Object.onReceiveStatus(/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:1188:28)       在InterceptingListener._callNext(/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:564:42)       在InterceptingListener.onReceiveStatus(/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:614:8)       在回调时(/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:841:24)     代码:14     元数据:元数据{_internal_repr:{}​​},     详细信息:“从插件获取元数据失败,错误:错误:0906D064:PEM例程:PEM_read_bio:坏的base64解码'}

产生此错误的代码是:

const automl = require('@google-cloud/automl')
const client = new automl.v1beta1.PredictionServiceClient({keyFilename: 'key_file.json'})
const formattedName = client.modelPath('<project-id>', 'us-central1', '<model-id>')
const payload = {
    textSnippet: {
        content: 'Recognize this text',
        mimeType: 'text/plain'
    }
}
const request = {
  name: formattedName,
  payload,
}
client.predict(request)
  .then(responses => console.log(responses[0].payload[0]))
  .catch(console.error(err))

如果我将 project-id model-id key-file.json 更改为自己的名称,那么这将是完美的。任何想法是什么原因造成的?

0 个答案:

没有答案