stack: rest readiness probe (GET /) never passes when a db_pre_request hook rejects requests without an app header
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 66/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- postgresql, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.4k
- Fork
- 537
- Merge trung bình
- 19 giờ 48 phút
- Pull request đã merge (30 ngày)
- 405
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của supabase/cli
-
config push: changing auth.oauth_server.authorization_url_path fails with 400 (enabled and path must be sent together)Có thể đã có người làm @itz-puneet đã nhận 2 ngày trước. Đang mở🐛 Bug supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
supabase/cli#7087 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructiveCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở✨ Feature supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
📘 Docs supabase/cli
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
supabase/cli#6974 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Migration error caret is missing or misplaced when the statement contains multibyte charactersĐang mở🐛 Bug supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 Bug supabase/cli
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
getsentry/sentry-conventions#732 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:in-linear status:team-assigned team:nodes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
n8n-io/n8n#41548 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
motiondivision/motion#3955 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DQ assisgnment closing at CRĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
equinor/prisma-decision-web#919 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
自荐 / Suggestion: Prisma ComputeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100