简体   繁体   English

Cloud Document AI API 之前没有在项目xxxxxx中使用过或被禁用

[英]Cloud Document AI API has not been used in project xxxxxx before or it is disabled

While calling google document api, getting below error.调用谷歌文档 api 时,出现以下错误。 apis are enabled, even after waiting for few hours still getting same error. api 已启用,即使等待几个小时后仍然出现相同的错误。 any suggestion任何建议

RpcException: Status(StatusCode="PermissionDenied", Detail="Cloud Document AI API has not been used in project xxxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/documentai.googleapis.com/overview?project=xxxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1646997388.673000000","description": "Error received from peer ipv4:234.234324.324234:443","file":"......\src\core\lib\surface\call.cc","file_line":1070,"grpc_message": "Cloud Document AI API has not been used in project xxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/documentai.googleapis.com/overview?project=xxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems RpcException: Status(StatusCode="PermissionDenied", Detail="Cloud Document AI API之前没有在项目xxxxxxx中使用过或者被禁用了。访问https://console.developers.google.com/apis/api/启用它documentai.googleapis.com/overview?project=xxxxxxx然后重试。如果您最近启用了这个 API,请等待几分钟让操作传播到我们的系统并重试。", DebugException="Grpc.Core.Internal.CoreErrorDetailException: { "created":"@1646997388.673000000","description": "Error received from peer ipv4:234.234324.324234:443","file":"......\src\core\lib\surface\call.cc ","file_line":1070,"grpc_message": "Cloud Document AI API 之前没有在项目 xxxxxx 中使用过或者被禁用了。访问https://console.developers.google.com/apis/api/启用它documentai.googleapis.com/overview?project=xxxx然后重试。如果您最近启用了这个 API,请等待几分钟,让操作传播到我们的系统 and retry.","grpc_status":7}")然后重试。","grpc_status":7}")

 ByteString content = ByteString.CopyFrom(bytes);

            DocumentProcessorServiceClient documentProcessorServiceClient = new DocumentProcessorServiceClientBuilder
            { CredentialsPath = "D:\\poised-aleph-3xx-6a3xxxx4343a03.json" }
            .Build();

            ProcessRequest request = new ProcessRequest
            {
                ProcessorName = ProcessorName.FromProjectLocationProcessor("invoiceprocessor", "us", "343431"),
                SkipHumanReview = true,
                RawDocument = new RawDocument
                {
                    MimeType = "application/pdf",
                    Content = content
                }
            };

            request.RawDocument.MimeType = "application/pdf";
            request.RawDocument.Content = content;

            // Make the request
            ProcessResponse response = await 
 documentProcessorServiceClient.ProcessDocumentAsync(request);

after fixing correct project id, as shown in developer console -> Prediction endpoint修复正确的项目 ID 后,如开发人员控制台 -> 预测端点所示

在此处输入图像描述

Detail="Permission 'documentai.processors.processOnline' denied on resource 
'//documentai.googleapis.com/projects/8xxxxxxxx7/locations/us/processors/axxxxxxxxxx1f' (or it may not exist)."

Adding Document AI Role to service account将文档 AI 角色添加到服务帐户

在此处输入图像描述

final fix最终修复在此处输入图像描述

Since @anand (OP) has already fixed the first issue as mentioned on the above updated question, OP got the below recent error由于@anand(OP)已经解决了上述更新问题中提到的第一个问题,OP 得到了以下最近的错误

RpcException: Status(StatusCode="PermissionDenied", Detail="Permission 'documentai.processors.processOnline' denied on resource 
'//documentai.googleapis.com/projects/xxxx/locations/us/processors/xxxxxx' (or it may not exist)."

This error is related on the permission of the service account being used to authenticate the API.此错误与用于验证 API 的服务帐户的权限有关。

You may update your Serivce Account permission by navigating to IAM & Admin > IAM您可以通过导航到IAM & Admin > IAM来更新您的服务帐户权限在此处输入图像描述

You may navigate on the list and edit the permission of your service account from that page.您可以在列表中导航并从该页面编辑您的服务帐户的权限。 You may follow this documentation on how to setup service account authentication for Document AI.您可以按照此文档了解如何为 Document AI 设置服务帐户身份验证。

Since your error message shows that you are having issues on documentai.processors.processOnline , you may grant the Cloud DocumentAI API User role to your service account since it has below permissions which also covered the one on your error message:由于您的错误消息显示您在documentai.processors.processOnline上遇到问题,您可以将Cloud DocumentAI API 用户角色授予您的服务帐户,因为它具有以下权限,也涵盖了您的错误消息中的权限:

documentai.operations.getLegacy , documentai.processors.processOnline , documentai.processors.processBatch . documentai.operations.getLegacydocumentai.processors.processOnlinedocumentai.processors.processBatch

You may also refer to this Document AI IAM Roles Documentation for more information on the pre-defined roles for Document AI.您还可以参阅此Document AI IAM 角色文档,了解有关 Document AI 预定义角色的更多信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firestore API之前没有在项目416788152002中使用过或者被禁用 - Firestore API has not been used in project 416788152002 before or it is disabled 书籍 API 之前未在项目 ******** 中使用过或已被禁用。 错误代码 403 - Books API has not been used in project ******** before or it is disabled. Error code 403 (Terraform) 错误403:Cloud Run Admin API之前没有在项目905986752003中使用过或者被禁用了。 通过访问 https://console.d 启用它 - (Terraform) Error 403: Cloud Run Admin API has not been used in project 905986752003 before or it is disabled. Enable it by visiting https://console.d 仅使用托管时,“项目中未使用 Cloud Functions API” - "Cloud Functions API has not been used in project" when only using hosting 计划错误:云资源管理器 API 尚未使用 - Plan Error: Cloud Resource Manager API has not been used 使用 flutter 检查是否已在 Cloud Firestore 上创建文档 - Checking if document has been created on Cloud Firestore using flutter 尝试使用 Google Cloud 文档 AI API 请求 Python 中的 field_mask 获取特定字段 - Trying to get specific fields using field_mask in Google Cloud document AI API request Python Firebase 已超出此项目错误的云存储配额 - Firebase cloud storage quota has been exceeded for this project error 使用 Google Document AI(表单解析器 API)进行身份验证 - Authentication with Google Document AI (Form Parser API) Google Document AI api 认证错误 - Google Document AI api authentication error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM