[Vue warn]: ошибка в созданном хуке: "Ошибка: {" clientConfig ": {}," порт ": 443," servicePath ":" vision.googleapis.com "," scopes ": - PullRequest
0 голосов
/ 24 сентября 2019

Я пытаюсь реализовать API Google Vision в Vuejs , но я получаю эту ошибку:

[Vue warn]: Error in created hook: "Error: {"clientConfig":{},"port":443,"servicePath":"vision.googleapis.com","scopes":["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloud-vision"]}You need to pass auth instance to use gRPC-fallback client in browser. Use OAuth2Client from google-auth-library."

Мой код для чтения текста с изображения:

// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ImageAnnotatorClient();

// Performs label detection on the image file
client
.textDetection('./myimage.png')
.then(result => {
 const texts = result[0].textAnnotations;
 console.log('Text:');
 texts.forEach(text => console.log(text.description));
 })
.catch(err => {
 console.error('ERROR:', err);
 });

Есть идеи как решить?

...