mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? This introduces a small snippet preview of the error code coming via our content API for the docs. This appears in a couple of places right now. - **Auth Overview** - This page isn't fully released yet, but it appears on the error codes table (as depicted below). - **Logs** - When you delve into the logs panel, if there's an error code available, they're also wrapped in this popover. We are also working on a shared-data package (#43458) to potentially replace this endpoint internally. Also introduces a multifaceted button to debug/fix with either Assistant or LLM of choice. | Auth Overview | Logs Panel | |--------|--------| | <img width="407" height="287" alt="Screenshot 2026-03-09 at 14 14 09" src="https://github.com/user-attachments/assets/7450dddb-6828-4cd3-802d-37d47ba1b440" /> | <img width="394" height="216" alt="Screenshot 2026-03-09 at 14 13 56" src="https://github.com/user-attachments/assets/80c2a46e-dbe4-4e88-a0a7-68b977a71d6b" /> | --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { IS_PLATFORM } from 'lib/constants'
|
|
import type { NextRequest } from 'next/server'
|
|
|
|
export const config = {
|
|
matcher: '/api/:function*',
|
|
}
|
|
|
|
// [Joshen] Return 404 for all next.js API endpoints EXCEPT the ones we use in hosted:
|
|
const HOSTED_SUPPORTED_API_URLS = [
|
|
'/ai/sql/generate-v4',
|
|
'/ai/sql/policy',
|
|
'/ai/feedback/rate',
|
|
'/ai/code/complete',
|
|
'/ai/sql/cron-v2',
|
|
'/ai/sql/title-v2',
|
|
'/ai/sql/filter-v1',
|
|
'/ai/onboarding/design',
|
|
'/ai/feedback/classify',
|
|
'/ai/docs',
|
|
'/get-ip-address',
|
|
'/get-utc-time',
|
|
'/get-deployment-commit',
|
|
'/check-cname',
|
|
'/edge-functions/test',
|
|
'/edge-functions/body',
|
|
'/generate-attachment-url',
|
|
'/incident-status',
|
|
'/api/integrations/stripe-sync',
|
|
'/content/graphql',
|
|
]
|
|
|
|
export function proxy(request: NextRequest) {
|
|
if (
|
|
IS_PLATFORM &&
|
|
!HOSTED_SUPPORTED_API_URLS.some((url) => request.nextUrl.pathname.endsWith(url))
|
|
) {
|
|
return Response.json(
|
|
{ success: false, message: 'Endpoint not supported on hosted' },
|
|
{ status: 404 }
|
|
)
|
|
}
|
|
}
|