Skip to content

Commit 6a24235

Browse files
author
CodeBuddy Attribution Bot
committed
fix(attribution): HTTP 云函数 Skill 缺少路径映射和网关路径处理的关键说明 (issue_mo1hkx69_frhv2z)
1 parent 1d7f519 commit 6a24235

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

config/.claude/skills/cloud-functions/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Keep local `references/...` paths for files that ship with the current skill dir
5050
- Confusing official CloudBase API client work with building your own HTTP function.
5151
- Mixing Event Function code shape (`exports.main(event, context)`) with HTTP Function code shape (`req` / `res` on port `9000`).
5252
- Treating HTTP Access as the implementation model for HTTP Functions. HTTP Access is a gateway configuration for Event Functions, not the HTTP Function runtime model.
53+
- Assuming an HTTP Function automatically gets a browser/public URL path, or assuming that path is always `/{functionName}`.
54+
- Writing gateway prefixes such as `/api/httpDemo` into the function router itself. Public gateway path and in-function route path are different layers.
5355
- Forgetting that runtime cannot be changed after creation.
5456
- Using cloud functions as the first answer for Web login.
5557
- Forgetting that HTTP Functions must ship `scf_bootstrap`, listen on port `9000`, and include dependencies.
@@ -199,6 +201,8 @@ server.listen(9000);
199201
- `manageGateway(action="createAccess")`
200202
- If gateway operations need raw cloud API fallback, read `./references/operations-and-config.md` first
201203

204+
When a user says they need browser/public access, do not assume creation already exposed the function. HTTP Function runtime routes still live inside the function, while gateway access adds an external path prefix separately.
205+
202206
## Related skills
203207

204208
- `cloudrun-development` -> container services, long-lived runtimes, Agent hosting

config/.claude/skills/cloud-functions/references/http-functions.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,29 @@ manageGateway({
143143
});
144144
```
145145

146+
### Path mapping model
147+
148+
Keep the public gateway path and the in-function router path as two different layers.
149+
150+
- `manageGateway(..., path: "/api/hello")` creates the **external** access prefix.
151+
- Your HTTP Function still matches its own internal routes such as `/`, `/health`, `/users`.
152+
- Do **not** rewrite the function router to include the gateway prefix.
153+
154+
Example mapping:
155+
156+
| External URL | Route your HTTP Function should handle |
157+
| --- | --- |
158+
| `https://{domain}/api/hello` | `/` |
159+
| `https://{domain}/api/hello/health` | `/health` |
160+
| `https://{domain}/api/hello/users` | `/users` |
161+
162+
For example, if you expose `path: "/api/httpDemo"`, the function code should normally keep handlers like `app.get("/")` and `app.get("/health")`. Do not change them to `app.get("/api/httpDemo")` or `app.get("/api/httpDemo/health")`.
163+
164+
If the external caller reports a 404, verify these two layers separately:
165+
166+
1. Use `queryGateway(action="getAccess")` to confirm which public path is actually exposed.
167+
2. Check the HTTP Function router to confirm it handles the internal path after the gateway prefix.
168+
146169
Before enabling anonymous access, confirm both of these:
147170

148171
1. The access path exists.

0 commit comments

Comments
 (0)