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

GKE中Rails应用无法向Google Cloud Error Reporting上报异常

Rails应用在GKE上配置Google Cloud Error Reporting无数据显示的排查与解决

问题场景

在GKE集群运行的Rails应用中配置Google Cloud Error Reporting时遇到异常:

  • 已安装stackdriver gem并在应用启动阶段引入
  • 在Rails控制台手动调用上报接口返回结果正常:
irb(main):021:0> Google::Cloud::ErrorReporting.report(Exception.new(msg: "from console")).result
=> [true, [], nil]
  • 确认project_id配置正确,且在GCP控制台查看的是对应项目,但Error Reporting界面始终无法看到上报的错误记录

排查步骤

开启DEBUG日志级别查看RPC调用细节后,捕获到权限相关报错:

Failing with status #<struct Struct::Status code=7, details="User not authorized.", metadata={}, debug_error_string="UNKNOWN:Error received from peer ipv4:xxx.xxx.xxx.xx:443 {grpc_message:\"User not authorized.\", grpc_status:7, created_time:\"2024-05-23T17:54:30.826579798+00:00\"}">

解决方案

为GKE应用所使用的服务账号添加errorreporting.errorEvents.create权限角色,操作完成后,错误成功上报并在Google Cloud Error Reporting界面正常显示。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.23 12:22:07