You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Google Vertex托管Jupyter Notebook中用R连接BigQuery遇API报错求助

在Vertex托管Jupyter Notebook中用R连接BigQuery的accessNotConfigured错误排查

问题描述

我在Google Vertex的托管Jupyter Notebook中尝试用R连接BigQuery,严格遵循谷歌官方文档操作,但始终触发accessNotConfigured错误。点击报错提示的链接显示访问被拒绝。已完成以下操作但问题仍未解决:

  • 启用BigQuery API、Notebooks API、Vertex AI API、BigQuery Connection API及BigQuery Data Transfer API
  • 配置IAM权限:拥有BigQuery Admin、Vertex AI Admin及BigQuery Connection Admin角色
  • 确认处于正确项目,且具备resourcemanager.projects.get通用权限
  • 查阅bigrquery官方文档未找到有效解决方案

报错信息

Error in signal_reason():
! BigQuery API has not been used in project XXXX before or it is disabled. Enable it by visiting [链接] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. [accessNotConfigured]

调用栈

1. bq_project_query(billing, sql)
2. bq_perform_query(query, billing = x, destination_table = destination_table,
.     ...)
3. bq_post(url, body = bq_body(body, ...), query = list(fields = "jobReference"))
4. process_request(req)
5. bq_check_response(status, type, content)
6. signal_reason(json$error$errors[[1L]]$reason, json$error$message)
7. rlang::abort(message, class = paste0("bigrquery_", reason))
8. signal_abort(cnd, .file)

排查与解决建议

  • 检查Notebook实例的服务账号权限:Vertex托管Notebook默认使用Compute Engine默认服务账号,而非个人IAM账号。确认该服务账号已被授予BigQuery相关权限(如BigQuery Admin),可在云控制台IAM页面搜索服务账号ID进行配置。
  • 等待权限/API缓存刷新:谷歌云的权限生效和API启用状态同步可能存在延迟,建议等待10-15分钟后,重启Notebook实例再尝试连接。
  • 显式指定服务账号密钥认证:生成并下载项目的服务账号密钥文件(JSON格式),上传至Notebook后,在R代码中添加认证语句:
    library(bigrquery)
    bq_auth(path = "your-service-account-key.json")
    
    绕开默认的实例认证,强制使用指定服务账号的权限。
  • 确认API启用的项目匹配:核对报错信息中的项目ID(XXXX)与当前操作的项目ID完全一致,避免因项目名称和ID混淆导致的API启用错误。
  • 重新验证API启用状态:直接进入谷歌云控制台的API库,搜索BigQuery API,确认其状态为“已启用”,且所属项目为报错中的XXXX项目。

内容的提问来源于stack exchange,提问作者Jennifer Cook

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 07:15:41