SOS 404 on Vercel
Description
I forked the project and, during the deploy process, created a classic Personal Access Token on GitHub. I then set this token as an environment variable, using PAT_2 as the variable name and the token as its value. The deploy completed successfully with a “Congratulations!” message, but when accessing the preview I received a 404 error. I am not sure whether this issue is related to the Node.js version used during the deploy.
i made an alternative method/solution for self hosted github streak stats, you can refer : https://github.com/DenverCoder1/github-readme-streak-stats/issues/860#issuecomment-3830999484
Description
I forked the project and, during the deploy process, created a classic Personal Access Token on GitHub. I then set this token as an environment variable, using PAT_2 as the variable name and the token as its value. The deploy completed successfully with a “Congratulations!” message, but when accessing the preview I received a 404 error. I am not sure whether this issue is related to the Node.js version used during the deploy.
I have similar question. What would be the correct process to deploy on Vercel? Any help is appreciated!
The 404 error is most likely caused by two things:
-
Wrong branch: You need to deploy the
vercelbranch, notmain. Themainbranch doesn't have the Vercel-specific configuration, so Vercel can't route requests correctly. This is called out in the README:Make sure that you host the
vercelbranch as otherwise you'll get a 404 error from Vercel. -
Wrong env variable name: The token must be set as
TOKEN, notPAT_2. The app looks for$_SERVER["TOKEN"]specifically.
Steps to fix:
- In your Vercel project settings, go to Git and set the production branch to
vercel - In Settings > Environment Variables, make sure the variable is named
TOKEN(notPAT_2) with your GitHub PAT as the value - Redeploy
I did the followings and successfully deployed on vercel.
- deloy the
vercelbranch Environment VariablesnamedTOKEN
However, I got the following warnings displayed above the streak stats card when use the source URL.
Warning: mkdir(): Read-only file system in /var/task/user/api/cache.php on line 57
Warning: http_response_code(): Cannot set response code - headers already sent (output started at /var/task/user/api/cache.php:57) in /var/task/user/api/card.php on line 876
Warning: Cannot modify header information - headers already sent by (output started at /var/task/user/api/cache.php:57) in /var/task/user/api/card.php on line 877