0

I'm using Google's AutoML Natural Language API for Node.js. Everything works great, except for a particular service account and user (a student of mine). She gets the following error:

Auth error:Error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode { Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode at Object.exports.createStatusError (/home/ubuntu/workspace/functions/node_modules/grpc/src/common.js:87:15) at Object.onReceiveStatus (/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:1188:28) at InterceptingListener._callNext (/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:564:42) at InterceptingListener.onReceiveStatus (/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:614:8) at callback (/home/ubuntu/workspace/functions/node_modules/grpc/src/client_interceptors.js:841:24) code: 14, metadata: Metadata { _internal_repr: {} }, details: 'Getting metadata from plugin failed with error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode' }

The code that produces this error is:

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))

If I change project-id, model-id, and key-file.json to my own, then this works perfect. Any ideas what's causing this?

at.
  • 50,922
  • 104
  • 292
  • 461
  • Sounds like one of her three inputs are incorrect or malformed. – CertainPerformance Sep 13 '18 at 23:51
  • I've checked and they all look good. Her *model-id* is copy-pasted from the same place I found my model id. Her *project-id* is correct and her key file looks exactly like mine except, of course, the project id, private key, etc data is a little different. – at. Sep 14 '18 at 00:40
  • May be indentation error? The private key should always with format like `-----BEGIN PRIVATE KEY-----{\n{someChar}*64\n}*{some constant}-----END PRIVATE KEY-----\n`. But I don't think google make such mistake for generating this key.... – MT-FreeHK Sep 14 '18 at 08:44
  • @MatrixTai I’ve compared JSON key files with mine, all _looks_ good... – at. Sep 15 '18 at 20:50

0 Answers0