跳到正文
cccskills
免费在 GitHub 公开

microservice-api-endpoint-routing-404

Debug 404 errors for API endpoints in microservice architectures where code exists but routing sends requests to wrong service. Use when: (1) API endpoint returns 404 despite code being deployed, (2) Multiple services share same hostname via HTTPRoute/Ingress, (3) Service logs show "Health server" but you expected API endpoints, (4) Monorepo deploys multiple images and endpoint might be in different service than expected. Covers: verifying which service handles which paths, HTTPRoute path precedence, testing endpoints directly from inside cluster, matching image tags across services.

中文简介正在准备中。当前显示原文说明。

集成工具Kubernetes
查看安装方法

包含的文件(1)

  • SKILL.md4.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Microservice API Endpoint Routing 404 Debugging

Problem

API endpoint returns 404 even though the code implementing it has been deployed. This commonly happens in microservice architectures where multiple services share the same hostname and HTTPRoutes/Ingress rules determine which service handles which paths.

Context / Trigger Conditions

  • New endpoint returns 404 but code is definitely deployed
  • Multiple services (e.g., relay + api) share the same external hostname
  • Service logs show "Health server listening" or similar health-only messages
  • HTTPRoute or Ingress rules split traffic by path prefix
  • Monorepo builds multiple Docker images from same commit

Solution

Step 1: Identify which service actually handles the path

Check HTTPRoute/Ingress rules to see routing:

kubectl get httproute <name> -n <namespace> -o yaml | grep -A 50 "rules:"

Look for path matching rules and which backend service they point to:

  • /api/* might go to api-service:8080
  • / might go to websocket-service:7777

Step 2: Test the endpoint directly on each service from inside cluster

kubectl run curl-test -n <namespace> --image=curlimages/curl --restart=Never \
  -- curl -v "http://<service-name>:<port>/<endpoint>" \
  && sleep 5 \
  && kubectl logs -n <namespace> curl-test \
  && kubectl delete pod -n <namespace> curl-test

This bypasses external routing and tests directly against each service.

Step 3: Check service logs for endpoint registration

kubectl logs -l app=<service-name> -n <namespace> --tail=50 | grep -i -E "(endpoint|route|api|listening)"

Look for messages like:

  • "Health server listening on 0.0.0.0:8080" = health only, no API
  • "API server listening" or "Registered /api/..." = serves API endpoints

Step 4: For monorepos, check if matching image exists for correct service

If feature was added to service A but endpoint is served by service B, check if service B has the same commit tag:

gcloud artifacts docker images list <registry>/<service-b> --include-tags --limit=10

Step 5: Deploy the correct service with feature + required env vars

Update the service that actually handles the endpoint path:

  • New image tag with the feature
  • Any environment variables (API keys, URLs) the feature needs
  • Any secrets referenced by the feature

Verification

  1. Service logs show endpoint registered: "Recommendations API enabled at /api/users/:pubkey/recommendations"
  2. Direct curl from inside cluster returns 200
  3. External request through HTTPRoute returns expected data

Example

Architecture:

Hostname: relay.example.com
  /api/* → funnelcake-api:8080 (REST API)
  /      → funnelcake-relay:7777 (WebSocket)

Problem: /api/users/x/recommendations returns 404

Investigation:

  1. HTTPRoute shows /api/* → funnelcake-api (not relay)
  2. Direct test to relay:8080 returns 404 (health server only)
  3. Direct test to api:8080 also returns 404 (old image)
  4. Registry shows both api and relay have image tag 3c0696a
  5. API was running old tag 487178e

Fix: Deploy funnelcake-api with tag 3c0696a + GORSE_URL + GORSE_API_KEY env vars

Notes

  • Services in same namespace can share Kubernetes Secrets
  • Health endpoints (/livez, /readyz) are often on separate port from API
  • HTTPRoute path matching: more specific paths take precedence
  • Always check which service handles which paths before assuming endpoint location

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y". Use when: (1) ExternalSecret shows OutOfSync in ArgoCD but won't sync, (2) ArgoCD application status shows "namespace X is not permitted in project 'infrastructure'", (3) ExternalSecret targets a namespace managed by a different ArgoCD project, (4) Using apps-of-apps pattern with separate infrastructure and application projects.

中文简介正在准备中。当前显示原文说明。

divinevideo/divine-mobile2652026年10月22日 更新

Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language. After selection, generates AI image prompts and visual briefs section-by-section. Use when the user shares content and needs visual direction, image sourcing, or creative direction for any material.

中文简介正在准备中。当前显示原文说明。

divinevideo/divine-mobile2652026年10月22日 更新

Fix "Null check operator used on a null value" errors when an object is set to null during an async await. Use when: (1) Object reference is nullified while awaiting, (2) Code accesses object with ! after await returns, (3) Cancel/dispose operations run concurrently with async operations on same object. Solution: capture local reference before await.

中文简介正在准备中。当前显示原文说明。

divinevideo/divine-mobile2652026年10月22日 更新

Add custom metadata headers (x-amz-meta-*) to AWS v4 signed requests for GCS S3-compatible API. Use when: (1) Adding custom metadata to GCS uploads via S3 API, (2) Getting signature mismatch errors after adding new headers, (3) x-amz-meta-* headers being ignored or causing 403 errors. Custom headers MUST be included in canonical headers and signed headers list.

中文简介正在准备中。当前显示原文说明。

divinevideo/divine-mobile2652026年10月22日 更新

Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings. Use when: (1) Password authentication fails with correct password, (2) Secret created with `<<< "value"` syntax, (3) Error like "password authentication failed" or "invalid token" despite correct value. Bash here-strings (`<<<`) add a trailing newline that corrupts secrets.

中文简介正在准备中。当前显示原文说明。

divinevideo/divine-mobile2652026年10月22日 更新

Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp). Use when: (1) Media moderation, transcoding, or analysis silently skips files from Blossom or content-addressed storage servers, (2) URL extraction from Nostr event tags (imeta, r tags) drops URLs without recognized extensions, (3) CDN fallback URLs append .mp4 but the actual server uses extensionless content-addressed paths like /{sha256}. Common in Nostr video events (kind 34236) where different clients use different URL formats.

中文简介正在准备中。当前显示原文说明。

divinevideo/divine-mobile2652026年10月22日 更新

查看 divinevideo 的全部技能

报告此技能的问题