-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: include route prefix in vercel func names, fix #8401 #8408
Conversation
🦋 Changeset detectedLatest commit: fd2c50c The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Since my proposed change injects route path to file name, I begun to wonder what is the maximum allowed length for serverless function name in Vercel build output? Since I couldn't find the answer in their documentation, I had to run some manual tests. The answer is: less than 240 characters. If
With that in mind, I think that the proposed solution is fine for the time being, just to fix the original issue. However ideally there should be a mechanism that limits function name length. |
thought: should we at least throw an error if the length is exceeded? Other option would be to hash the path into fixed-size string and use only the filename, e.g. |
I thought about limiting the file name to a sane number of characters and adding short content hash to the end. I like to have route included in the function name - as you said, it simplifies debugging and makes debug. Now when I think about it, we could ditch |
|
The complete file extension is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments. I think overall, we could release this fix.
Changes
Recently updated Vercel adapter has a bug. If two routes have identical file names but different directory structures, the adapter will produce only one serverless function and assign it to both routes.
This PR fixes the problem.
Some more details: #8401
Testing
Within vercel adapter I created 'serverless-with-dynamic-routes' fixture and added necessary tests. If you run those tests against current
main
, the will fail.Docs
No need to update docs. This PR only fixes a rather major bug and brings the expected behavior.