fix: reduce functions count to avoid Hobby plan limit - #932
Open
0rlandoMG wants to merge 2 commits into
Open
Conversation
Added a line indicating the project is made with PHP.
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.
Problem
When deploying a fork to Vercel's Hobby (free) plan, the build fails with:
This happens even on a fresh, unmodified fork of the
vercelbranch.Cause
In
vercel.json, thefunctionsblock uses the glob patternapi/**/*.php:This causes every
.phpfile underapi/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 onlyrequired byapi/index.php; they aren't independent endpoints.Looking at the
routessection, only 3 files are actually routed to as endpoints:api/index.phpapi/demo/index.phpapi/demo/vercel-static.phpCounting 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
functionsglob to only the 3 files that are actually used as HTTP endpoints, matching what's declared inroutes:All the other PHP files continue to work exactly as before — they're still
required normally byindex.phpas plain PHP includes, they just stop being counted as separate serverless functions.Testing
Tested by forking the
vercelbranch and deploying to a Vercel Hobby account: