我正在尝试在Firebase 云存储文件上运行 Vision API文档文本检测。但我收到了这个错误:
code: 7,
details: 'Error opening file: gs://some-name.appspot.com/UsersUploadedFiles/2kuqctFfY0d0sF7ImcDk7Ci2MJo2/questions.pdf.',
metadata: Metadata { internalRepr: Map {}, options: {} },
note: 'Exception occurred in retry method that was not classified as transient'
我已经通过环境变量传递了服务帐户凭据,并且我正在调用 Vision API,nodejs
如下所示:
const inputConfig = {
mimeType: 'application/pdf',
gcsSource: {
uri: 'gs://some-name.appspot.com/UsersUploadedFiles/2kuqctFfY0d0sF7ImcDk7Ci2MJo2/questions.pdf',
},
};
const outputConfig = {
gcsDestination: {
uri: 'gs://some-name.appspot.com/TranscribedData/2kuqctFfY0d0sF7ImcDk7Ci2MJo2/',
},
};
const features = [{ type: "DOCUMENT_TEXT_DETECTION" }];
const request: any = {
requests: [
{
inputConfig: inputConfig,
features: features,
outputConfig: outputConfig,
},
],
};
const [operation] = await client.asyncBatchAnnotateFiles(request);
const [filesResponse] = await operation.promise();
const destinationUri =
filesResponse.responses[0].outputConfig.gcsDestination.uri;