all `client.webhooks` operations fail with API error occurred: Status 404

未关闭
#3,316 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@VISHNU0906 已经在做这个了。

开始于 2026年11月8日。

  • #3319 来自 @VISHNU0906 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
54/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
api

调研方向

Start by tracing how client.webhooks builds its request path and how the client selects the API version from HttpOptions; the issue identifies /v1/webhooks and /v1beta as the failing and working routes. Check the webhooks tests and add coverage showing that management calls use v1beta routing by default while other client routing remains unaffected. Done means the reported 404 is covered and webhook list and create calls use the deployed route.

由索引模型根据 Issue 内容生成。

描述

priority: p2 type: bug
Description

In the latest major version (v3.0.0+), all client.webhooks operations—including client.webhooks.list() and client.webhooks.create()—fail with a google.genai._gaos.errors.genaidefaulterror.GenAiDefaultError: API error occurred: Status 404.

This occurs because v3.0.0 changed the default developer API routing version to v1. However, the Gemini webhooks subsystem is currently only deployed on the v1beta path structure. Because the SDK makes calls directly to /v1/webhooks, Google's production servers reject the route with a standard 404 HTML document page. The SDK should explicitly default to v1beta routing internally for webhooks management.

Environment Details
  • SDK Package: google-genai (v3.0.0 and above)
  • Auth Layer: Google AI Studio developer API key (api_key="...")
Steps to Reproduce
from google import genai

# Standard initialization defaults to /v1/ routes in v3.0.0+
client = genai.Client(api_key="VALID_GEMINI_KEY")

# Triggers the 404 exception loop instantly
webhooks = client.webhooks.list()
Traceback Log
google.genai._gaos.errors.genaidefaulterror.GenAiDefaultError: API error occurred: Status 404 Content-Type text/html. Body: ""
...
google.genai._gaos.lib.compat_errors.NotFoundError: Error code: 404
Working Workarounds
Workaround 1: Explicitly pass HttpOptions to the Client (Recommended)

You can override the client's automated route configuration to force the endpoint path back to v1beta where the webhooks framework is live:

from google import genai
from google.genai.types import HttpOptions

client = genai.Client(
    api_key="YOUR_GEMINI_API_KEY",
    http_options=HttpOptions(api_version="v1beta")
)

# This succeeds perfectly
webhooks_list = client.webhooks.list()
Workaround 2: Environment Variable Override

Setting the framework version override globally in the active terminal environment shell also bypasses the 404 issue:

  • Windows Cmd: set GOOGLE_GENAI_API_VERSION=v1beta
  • PowerShell: $env:GOOGLE_GENAI_API_VERSION="v1beta"
  • Linux/macOS: export GOOGLE_GENAI_API_VERSION="v1beta"
主要语言
Python
星标
4.1k
派生
1.1k
平均合并
1 天 20 小时
30 天内合并 PR
99

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleapis/python-genai 的其他 Issue

查看 googleapis/python-genai 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。