Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(navigation): swallow 403 on boot-time proxy_records fetch (#68387)

posthog[bot]7ccaea8d5d84
diff --git a/frontend/src/layout/navigation/projectNoticeLogic.test.tsx b/frontend/src/layout/navigation/projectNoticeLogic.test.tsx
index 749684c1bab1..e282f01587ef 100644
--- a/frontend/src/layout/navigation/projectNoticeLogic.test.tsx
+++ b/frontend/src/layout/navigation/projectNoticeLogic.test.tsx
@@ -117,7 +117,10 @@ describe('projectNoticeLogic', () => {
})
})
- describe('proxy records 401 handling', () => {
+ describe.each([
+ { status: 401, reason: 'missing or expired session' },
+ { status: 403, reason: 'restricted org member below read access' },
+ ])('proxy records $status handling', ({ status }) => {
let getItemSpy: jest.SpyInstance
let getDateSpy: jest.SpyInstance
@@ -125,8 +128,8 @@ describe('projectNoticeLogic', () => {
useMocks({
get: {
// Function form so the [status, body] tuple is honored — a static array value
- // would be served as a 200 JSON body instead of a 401.
- '/api/organizations/:organization_id/proxy_records': () => [401, {}],
+ // would be served as a 200 JSON body instead of the error status.
+ '/api/organizations/:organization_id/proxy_records': () => [status, {}],
},
post: {
'/api/environments/:team_id/query/:kind': () => [200, { results: [] }],
@@ -142,7 +145,7 @@ describe('projectNoticeLogic', () => {
getDateSpy.mockRestore()
})
- it('swallows a 401 instead of surfacing a load failure', async () => {
+ it(`swallows a ${status} instead of surfacing a load failure`, async () => {
const logic = projectNoticeLogic()
logic.mount()
diff --git a/frontend/src/layout/navigation/projectNoticeLogic.tsx b/frontend/src/layout/navigation/projectNoticeLogic.tsx
index ea4dd047c7ee..cc31d6e51bab 100644
--- a/frontend/src/layout/navigation/projectNoticeLogic.tsx
+++ b/frontend/src/layout/navigation/projectNoticeLogic.tsx
@@ -316,9 +316,10 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
const response = await api.get(`api/organizations/${values.currentOrganizationId}/proxy_records`)
return response.results
} catch (error) {
- // A missing or expired session makes this boot-time GET 401. There's no banner to
- // show an unauthenticated user, so swallow it rather than polluting error tracking.
- if (error instanceof ApiError && error.status === 401) {
+ // A missing or expired session makes this boot-time GET 401. A restricted org member
+ // whose access level to the org resource is below read gets a 403 from the RBAC layer.
+ // Either way there's no banner to show, so swallow it rather than polluting error tracking.
+ if (error instanceof ApiError && (error.status === 401 || error.status === 403)) {
return null
}
throw error