Skip to content

Commit e855b08

Browse files
authored
fix(routes): Use different route to perform event redirect (#69439)
There are some org slugs that collide with marketing routes. When this happens, this request to attempt a redirect gets routed to vercel and results in an unexpected 404. This same redirect endpoint is also available at a different route that looks like `/organizations/{org_slug}/projects{proj_slug}/events/{event_id}` that will not be redirected. So change the endpoint to avoid the issue with the redirect.
1 parent 020fc0c commit e855b08

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

static/app/views/projectEventRedirect.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {RouteComponentProps} from 'react-router';
44
import DetailedError from 'sentry/components/errors/detailedError';
55
import * as Layout from 'sentry/components/layouts/thirds';
66
import {t} from 'sentry/locale';
7+
import {useParams} from 'sentry/utils/useParams';
78

89
type Props = RouteComponentProps<{}, {}>;
910

@@ -20,11 +21,13 @@ type Props = RouteComponentProps<{}, {}>;
2021
function ProjectEventRedirect({router}: Props) {
2122
const [error, setError] = useState<string | null>(null);
2223

24+
const params = useParams();
25+
2326
useEffect(() => {
2427
// This presumes that _this_ React view/route is only reachable at
2528
// /:org/:project/events/:eventId (the same URL which serves the ProjectEventRedirect
2629
// Django view).
27-
const endpoint = router.location.pathname;
30+
const endpoint = `/organizations/${params.orgId}/projects/${params.projectId}/events/${params.eventId}/`;
2831

2932
// Use XmlHttpRequest directly instead of our client API helper (fetch),
3033
// because you can't reach the underlying XHR via $.ajax, and we need
@@ -55,7 +58,7 @@ function ProjectEventRedirect({router}: Props) {
5558
xhr.onerror = () => {
5659
setError(t('Could not load the requested event'));
5760
};
58-
});
61+
}, [params, router]);
5962

6063
return error ? (
6164
<DetailedError heading={t('Not found')} message={error} hideSupportLinks />

0 commit comments

Comments
 (0)