This repository was archived by the owner on Aug 15, 2025. It is now read-only.
-
Couldn't load subscription status.
- Fork 120
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
Bug Report: CORS Policy and Server Errors in GitHub Wrapped Web App #331
Copy link
Copy link
Open
Description
Description
Accessing the GitHub Wrapped web app resulted in multiple errors related to the API endpoints, including CORS issues, a 500 internal server error, and JavaScript runtime exceptions. These issues prevent the application from functioning as expected for certain users.
Steps to Reproduce
- Navigate to the GitHub Wrapped web app: https://www.githubwrapped.io/.
- Attempt to interact with the "wrapped" feature using the my ID
myID. - Observe errors in the browser's developer console.
Observed Errors
-
CORS Policy Issue:
- Error Message:
Access to XMLHttpRequest at 'https://api.githubtrends.io/wrapped/valid/myID' from origin 'https://www.githubwrapped.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. - Affected URLs:
https://api.githubtrends.io/wrapped/valid/myID
- Error Message:
-
Failed Resource Loading:
- Error Message:
Failed to load resource: net::ERR_FAILED
- Error Message:
-
500 Internal Server Error:
- Error Message:
https://api.githubtrends.io/wrapped/myID?year=2024:1 Failed to load resource: the server responded with a status of 500 ()
- Error Message:
-
JavaScript Runtime Error:
- Error Message:
SelectUser.js:69 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'includes') at f (SelectUser.js:69:19) - File and Line Number:
SelectUser.js:69
- Error Message:
Expected Behavior
The app should successfully fetch data from the API and display the user's wrapped information without errors.
Environment
- Browser: Chrome
- Operating System: macOS/Windows/Linux
- URL: https://www.githubwrapped.io/
Possible Causes
- CORS Misconfiguration: The API server (
api.githubtrends.io) does not include theAccess-Control-Allow-Originheader, blocking cross-origin requests. - Backend Issue: The server responded with a 500 error for the endpoint
https://api.githubtrends.io/wrapped/myID?year=2024, indicating a potential bug in the backend logic. - Frontend Error: The JavaScript runtime error suggests insufficient null-checking for the response data.
Suggested Fixes
-
CORS Configuration:
- Update the API server to include the
Access-Control-Allow-Originheader with a value of*or the specific originhttps://www.githubwrapped.io.
- Update the API server to include the
-
Backend Debugging:
- Investigate and resolve the 500 error by reviewing logs and exception handling for the endpoint
GET /wrapped/myID?year=2024.
- Investigate and resolve the 500 error by reviewing logs and exception handling for the endpoint
-
Frontend Code Update:
- Add null-checking in
SelectUser.js:if (data && data.includes) { // Handle includes logic } else { console.error("Data is null or undefined."); }
- Add null-checking in
Additional Context
- Chrome logs mention a shift towards stricter cookie policies which might also affect API calls in the future.
- Users are currently unable to proceed due to these errors, making the feature unusable.
Priority: High
Labels: Bug, Backend, Frontend, CORS
fu050409
Metadata
Metadata
Assignees
Labels
No labels