fix: restore CORS headers on /api/libraries#2522
Merged
Simek merged 1 commit intoJun 15, 2026
Merged
Conversation
Simek
approved these changes
Jun 15, 2026
Simek
left a comment
Member
There was a problem hiding this comment.
Hey Aman, heh, I was wondering why it's required, now I remember. 🙂
Thanks for catching and restoring headers. 👍
Contributor
Author
haha Thank you for taking a look at this PR so quickly! Expo docs and its users thank you ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Why & how
PR #2520 rewrote the headers() array in
next.config.tsand inadvertently dropped the existing/api/librariesCORS entry. As a result, the endpoint stopped sending Access-Control-Allow-Origin in production.This breaks every cross-origin browser consumer of the API. In particular, the React Native Directory results in the Expo docs search command menu (docs.expo.dev) now fail with "blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present" followed by
"Uncaught (in promise) TypeError: Failed to fetch", which takes down the whole search dialog rather than just the directory section.This PR re-adds the
/api/librariesCORS rule to the headers() array innext.config.ts.✅ Checklist
react-native-libraries.jsonreact-native-libraries.json