首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >云文档AI无法处理存储中的文档

云文档AI无法处理存储中的文档
EN

Stack Overflow用户
提问于 2020-10-24 20:57:46
回答 1查看 164关注 0票数 0

我有以下代码:

代码语言:javascript
复制
const client = new DocumentProcessorServiceClient();

const inputConfig = {
    mimeType: 'application/pdf',
    gcsSource: {
        uri: gcsSourceUri,
    },
};
const outputConfig = {
    gcsDestination: {
        uri: gcsDestinationUri,
    },
};
const name = `projects/myproject/locations/us/processors/myprocessor`;
const request = {
    name,
    inputConfigs: [inputConfig],
    outputConfig: outputConfig
};

async function getText() {
    const [operation] = await client.batchProcessDocuments(request);
};

getText();

这会产生以下错误:

代码语言:javascript
复制
(node:72144) UnhandledPromiseRejectionWarning: Error: Failed to process all the documents
    at Operation._unpackResponse (E:\development\audiobook\node_modules\google-gax\build\src\longRunningCalls\longrunning.js:136:31)
    at E:\development\audiobook\node_modules\google-gax\build\src\longRunningCalls\longrunning.js:122:18
(node:72144) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:72144) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

这里的问题可能是什么?云存储URI正常工作,并且文件的格式正确。

EN

回答 1

Stack Overflow用户

发布于 2021-01-21 19:20:07

在我的例子中,问题出在outputConfig的格式上。

检查你的代码,我发现你是这样定义outputConfig的:

代码语言:javascript
复制
const outputConfig = {
    gcsDestination: {
        uri: gcsDestinationUri,
    },
};

而根据documentation,您应该将其更改为

代码语言:javascript
复制
 const outputConfig = {
        gcsDestination: {
            gcsDestinationUri: 'gs://bucket-name/folder/',
        },
    };
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64513542

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档