stack: rest readiness probe (GET /) never passes when a db_pre_request hook rejects requests without an app header
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 66/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- postgresql, typescript
调研方向
Find the experimental stack rest service recipe and its readiness probe; compare it with the Docker recipe’s PostgREST admin port configuration and the native runtime’s exposed ports. Check the readiness and service startup tests first. Done means the service becomes ready when PostgREST is serving even if db_pre_request rejects an anonymous GET /, and the eager and lazy startup cases pass.
由索引模型根据 Issue 内容生成。
描述
Affected area
Local development: experimental stack engine ([experimental] stack = true), rest service readiness.
Supabase CLI version
2.121.0 and 2.122.0-beta.1
Operating system
Linux x86_64 (glibc 2.44)
Installation method
npx
Command
supabase start --runtime native --eager (also reproduced with lazy start)
Actual output
With --eager, start fails:
ExperimentalStackStartError: Composition start had failures
rest (...): ... is not ready: rest HTTP readiness timed out
Recent stdout:
127.0.0.1 - anon [...] "GET / HTTP/1.1" 403 71 "" ""
127.0.0.1 - anon [...] "GET / HTTP/1.1" 403 71 "" ""
With the default lazy start, supabase start succeeds, but the first Data API request (which carries the header the hook requires) waits about 60 s and then returns 502 from the gateway, because rest never becomes ready. The same request sent directly to the PostgREST process returns 200.
Expected behavior
rest is reported ready once PostgREST is up and serving, independent of how the project's db_pre_request hook answers an anonymous GET /.
The rest recipe hardcodes healthPath: "/" on the data port. GET / runs the configured db_pre_request function, so any project whose hook rejects requests without an application header (for example a shared proxy-secret check) can never pass readiness. PostgREST has an admin server with GET /ready for this purpose; the Docker recipe already sets PGRST_ADMIN_SERVER_PORT. In the native runtime I only saw the data port listening. Probing /ready on the admin port, or treating any HTTP response from the data port as "up", would fix it.
Steps to reproduce
SUPABASE_EXPERIMENTAL_STACK=1 supabase init- Add
supabase/migrations/20260101000000_pre_request_hook.sql:
create schema hooks;
create function hooks.check_request() returns void language plpgsql as $$
begin
if current_setting('request.headers', true)::json->>'x-app-secret' is distinct from 'expected' then
raise sqlstate 'PGRST' using
message = json_build_object('code', 'APP_403', 'message', 'Unauthorized.')::text,
detail = json_build_object('status', 403, 'headers', json_build_object())::text;
end if;
end;
$$;
grant usage on schema hooks to anon, authenticated, service_role;
grant execute on function hooks.check_request() to anon, authenticated, service_role;
alter role authenticator set pgrst.db_pre_request = 'hooks.check_request';
notify pgrst, 'reload config';
create table public.notes (id int primary key);
grant select on public.notes to anon;
supabase start --runtime native --eagerfails withrest HTTP readiness timed out.- Control: without that migration, the same command exits 0.
- Lazy variant:
supabase start --runtime native, thencurl -H 'x-app-secret: expected' -H "apikey: $PUBLISHABLE_KEY" "$API_URL/rest/v1/notes"returns502after about 60 s.
Crash report ID
N/A
Docker and service versions
Native runtime (PostgREST 16.4, Postgres 17). The Docker runtime uses the same recipe healthPath.
Additional context
The default (non-stack) engine works with the same hook, so this blocks adopting per-worktree stacks for projects that gate the Data API in a pre-request hook.
- 主要语言
- TypeScript
- 星标
- 2.4k
- 派生
- 537
- 平均合并
- 21 小时 24 分钟
- 30 天内合并 PR
- 378
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
supabase/cli 的其他 Issue
-
config push: changing auth.oauth_server.authorization_url_path fails with 400 (enabled and path must be sent together)可能已有人在做 @itz-puneet 今天认领。 未关闭🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructive可能重新可做 关联的 PR 已关闭且未合并。 未关闭✨ Feature supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
stack: the HTTP gateway closes idle keep-alive connections after 5 s, so a client whose event loop is blocked gets ECONNRESET (`fetch failed`) on its next request可能已有人在做 @7ttp 于 15 天前认领。 未关闭🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
📘 Docs supabase/cli
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
521xueweihan/HelloGitHub#4025 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
voidzero-dev/void#478 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 69/100
Small-tailqwq/dsh-deep-whale#207 ·
维护者通常 1 天内回复
-
The inspector never shows the instances field, so scaling out is unreachable可能已有人在做 @Mrkewl 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
xevrion/breakscale#96 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
Flux159/mcp-server-kubernetes#384 ·