Skip to content

fix: reduce functions count to avoid Hobby plan limit - #932

Open
0rlandoMG wants to merge 2 commits into
DenverCoder1:vercelfrom
0rlandoMG:vercel
Open

fix: reduce functions count to avoid Hobby plan limit#932
0rlandoMG wants to merge 2 commits into
DenverCoder1:vercelfrom
0rlandoMG:vercel

Conversation

@0rlandoMG

Copy link
Copy Markdown

Problem

When deploying a fork to Vercel's Hobby (free) plan, the build fails with:

No more than 12 Serverless Functions can be added to a Deployment on the Hobby plan.

This happens even on a fresh, unmodified fork of the vercel branch.

Cause

In vercel.json, the functions block uses the glob pattern api/**/*.php:

"functions": {
  "api/**/*.php": {
    "runtime": "vercel-php@0.9.0"
  }
}

This causes every .php file under api/ to be deployed as its own separate serverless function — including internal library files that are never called directly over HTTP (cache.php, card.php, colors.php, generator.php, stats.php, themes.php, translations.php, whitelist.php, etc.). These files are only required by api/index.php; they aren't independent endpoints.

Looking at the routes section, only 3 files are actually routed to as endpoints:

  • api/index.php
  • api/demo/index.php
  • api/demo/vercel-static.php

Counting each PHP file as a function pushes the total past the Hobby plan's 12-function limit, blocking self-hosting for free-tier users — which contradicts the README's claim that Vercel is "free and easy to set up."

Fix

This PR narrows the functions glob to only the 3 files that are actually used as HTTP endpoints, matching what's declared in routes:

"functions": {
  "api/index.php": {
    "runtime": "vercel-php@0.9.0"
  },
  "api/demo/index.php": {
    "runtime": "vercel-php@0.9.0"
  },
  "api/demo/vercel-static.php": {
    "runtime": "vercel-php@0.9.0"
  }
}

All the other PHP files continue to work exactly as before — they're still required normally by index.php as plain PHP includes, they just stop being counted as separate serverless functions.

Testing

Tested by forking the vercel branch and deploying to a Vercel Hobby account:

  • Before this change: build failed immediately with the 12-function limit error.
  • After this change: deployment succeeds, function count drops to 3, and the streak card renders correctly with real GitHub data.

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