github-readme-streak-stats icon indicating copy to clipboard operation
github-readme-streak-stats copied to clipboard

SOS 404 on Vercel

Open heliocarlitos opened this issue 10 months ago • 4 comments

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.

heliocarlitos avatar Jan 22 '26 15:01 heliocarlitos

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

muhammad-fiaz avatar Feb 01 '26 12:02 muhammad-fiaz

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!

hongbozheng avatar Mar 14 '26 04:03 hongbozheng

The 404 error is most likely caused by two things:

  1. Wrong branch: You need to deploy the vercel branch, not main. The main branch 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 vercel branch as otherwise you'll get a 404 error from Vercel.

  2. Wrong env variable name: The token must be set as TOKEN, not PAT_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 (not PAT_2) with your GitHub PAT as the value
  • Redeploy

pratyush618 avatar Mar 28 '26 20:03 pratyush618

I did the followings and successfully deployed on vercel.

  1. deloy the vercel branch
  2. Environment Variables named TOKEN

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

hongbozheng avatar Mar 28 '26 20:03 hongbozheng