Skip to content

fix(api): make every Vercel function return a response - #106

Merged
creatorcluster merged 1 commit into
creatorcluster:mainfrom
Coder-soft:redesign/app
Oct 18, 2026
Merged

creatorcluster merged 1 commit into
creatorcluster:mainfrom
Coder-soft:redesign/app

Conversation

@Coder-soft

Copy link
Copy Markdown

Fixes a production bug where eight of the eleven api/*.js functions never returned.

The bug

Vercel's Node.js runtime ignores a Response returned from a default-exported function, so any handler written as export default async function handler(req) never finished: the invocation hung until the function limit and the platform returned FUNCTION_INVOCATION_TIMEOUT (504). The repository already documented this in api/music-link.js:

Vercel's Node.js runtime ignores a Response returned from a default-exported function, so expose the Web fetch handler it recognizes instead.

Only api/stats.js, api/track.js and api/music-link.js used that shape. Everything else was affected.

Measured against the deployment directly (bypassing renderdragon.org, so Cloudflare is not involved):

endpoint before after
GET /api/avatar 504 after 10.5s 200 image
GET /api/downloadThumbnail 504 after 10.5s 200 image
GET /api/uptime 504 after 10.5s 200 JSON
POST /api/generateTitles 504 after 10.8s responds immediately
POST /api/deleteAccount 504 after 11.1s 401 immediately
GET /api/download never responded responds
POST /api/looney-check never responded responds
GET /api/info never responded responds
GET /api/stats (control) 401 in 0.5s unchanged
POST /api/track (control) 204 in 0.5s unchanged

So avatars, the YouTube info and thumbnail tools, AI title generation, Looney checks and account deletion were all broken for real users on the live site, independent of this branch.

The change

All eight files now use the working shape: a named handler export plus export default { fetch: handler }. server.js imports the named handler, so the local Express adapter is unchanged in behaviour. No handler bodies were touched.

Verified locally through the Express adapter: /api/uptime 200 with the full feed, /api/avatar?u=... 200 image/png, /api/avatar without params 400, /api/downloadThumbnail 200 image, POST /api/generateTitles responds, POST /api/deleteAccount 401, POST /api/looney-check 400. ESLint clean.

Note for review: api/info.js, api/download.js and api/looney-check.js keep their export const config = { runtime: 'nodejs' }. If Vercel rejects that combination with the { fetch } default export, the fix is to drop the config block, since api/ already defaults to the Node runtime.

Every function exporting `default async function handler(req)` was dead in production: Vercel's Node runtime ignores a Response returned from a default export, so the invocation hung until the 10s limit and returned FUNCTION_INVOCATION_TIMEOUT. That took down avatars, the YouTube info and thumbnail tools, AI title generation, Looney checks and account deletion, and the new /api/uptime.

All eight now use the shape already used by api/stats.js, api/track.js and api/music-link.js: a named handler plus `export default { fetch: handler }`. server.js imports the named handler for the local Express adapter.
@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Coder-soft is attempting to deploy a commit to the yamura3's projects Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@creatorcluster
creatorcluster merged commit ef5d954 into creatorcluster:main Oct 18, 2026
0 of 3 checks passed
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7db1b10d-d7ff-4f5f-973b-366dde539865
📥 Commits

Reviewing files that changed from the base of the PR and between 55288b1 and a9c8738.

📒 Files selected for processing: 9
  • api/avatar.js
  • api/deleteAccount.js
  • api/download.js
  • api/downloadThumbnail.js
  • api/generateTitles.js
  • api/info.js
  • api/looney-check.js
  • api/uptime.js
  • server.js
+-------------------------------------------+
| I am a verified code reviewer on Twitter. |
+-------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants