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 dynamic server usage in app router docs route #168

Merged
merged 1 commit into from
May 10, 2024

Conversation

blomqma
Copy link
Owner

@blomqma blomqma commented May 10, 2024

Currently in the app router docs route we read the request headers directly from the original request object. This is problematic because it leads to a dynamic server usage error unless the docs endpoint is explicitly set to force-dynamic caching strategy. By reading the headers from a cloned request object the docs endpoint can be used with the default caching strategy, fixing this issue.

Copy link

vercel bot commented May 10, 2024

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

Name Status Preview Comments Updated (UTC)
next-rest-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 10:28am
next-rest-framework-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 10:28am

Currently in the app router docs route we read the request
headers directly from the original request object. This is
problematic because it leads to a dynamic server usage
error unless the docs endpoint is explicitly set to `force-dynamic`
caching strategy. By reading the headers from a cloned request
object the docs endpoint can be used with the default caching
strategy, fixing this issue.
@blomqma blomqma force-pushed the docs-route-req-clone-fix branch from 5b1a58f to 6825ae1 Compare May 10, 2024 10:26
@blomqma blomqma merged commit d4e5109 into main May 10, 2024
4 of 6 checks passed
@blomqma blomqma deleted the docs-route-req-clone-fix branch May 10, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant