Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix api/auth route conflict #9153

Merged
merged 4 commits into from
Feb 15, 2024
Merged

Fix api/auth route conflict #9153

merged 4 commits into from
Feb 15, 2024

Conversation

mjq-sentry
Copy link

The api/auth route added for the changelog conflicts with the api/auth docs page that would normally be handled by the catchall [[...path]] route, causing those doc pages to 404.

Since the newly added api/auth is used by the changelog, move it under the changelog path to fix the route conflict.

The `api/auth` route added for the changelog conflicts with the `api/auth` docs
page that would normally be handled by the catchall `[[...path]]` route,
causing those doc pages to 404.

Since the newly added `api/auth` is used by the changelog, move it under the
`changelog` path to fix the route conflict.
Copy link

vercel bot commented Feb 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2024 10:54pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
sentry-docs-next ⬜️ Ignored (Inspect) Visit Preview Feb 15, 2024 10:54pm

Commit 680c7c4 added memoized the fetch for OpenAPI JSON in the
`resolveOpenAPI` function, but that particular implementation caused some
problems with the build output. Some of the pages in the API section went
missing.

The previous implementation was susceptible to a bit of a race condition, since
the cached value wasn't set until after several async calls. When Next tries to
aggressively build pages, multiple calls could have gotten through to do live
calls, and then all of them would have tried to set the cache variable. I don't
know the exact pathway to the issue but I suspect this had something to do with
the missing pages (some sort of data corruption?). Sorry, I know this is handwavy.

Anyway, replacing that implementation with a more robust one - one that caches
a promise on the first call, and reuses that promise on all future calls - will
definitely only fetch once per process. When the fetch completes, everyone
waiting on the promise will awaken, and then future callers of the method will
get a resolved promise for immediate results.

And, most importantly, this method of caching doesn't cause the `api/auth` and
`api/guides` pages to go missing.
@mjq-sentry mjq-sentry enabled auto-merge (squash) February 15, 2024 22:37
@mjq-sentry mjq-sentry merged commit 37b224a into master Feb 15, 2024
9 of 10 checks passed
@mjq-sentry mjq-sentry deleted the mjq-auth-404 branch February 15, 2024 22:51
@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants