Skip to content

Replace Next.js with Vercel native serverless functions#109

Merged
Andarist merged 7 commits intochangesets:masterfrom
marcalexiei:serverless
May 8, 2026
Merged

Replace Next.js with Vercel native serverless functions#109
Andarist merged 7 commits intochangesets:masterfrom
marcalexiei:serverless

Conversation

@marcalexiei
Copy link
Copy Markdown
Contributor


next was only used to expose a single webhook endpoint.

This PR removes it entirely in favour of Vercel's zero-config api/ directory convention.

Important

I've read about here: https://vercel.com/docs/functions,
it sounds that they should be enough for the bot use case

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

@marcalexiei is attempting to deploy a commit to the Changesets Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
changesets-bot Ready Ready Preview, Comment May 8, 2026 9:25am

Request Review

@Andarist
Copy link
Copy Markdown
Member

Andarist commented May 5, 2026

Deployment fails with:

Warning: Could not identify Next.js version, ensure it is defined as a project dependency.
Error: No Next.js version detected. Make sure your package.json has "next" in either "dependencies" or "devDependencies". Also check your Root Directory setting matches the directory of your package.json file.

Comment thread vercel.json
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a vercel.json with a minimal configuration setting "framework": null.

This disables Vercel’s framework auto-detection, which was incorrectly identifying the project as Next.js after the migration to native serverless functions.

If the deployment still fails, check the Vercel dashboard → Project Settings → General → Framework Preset, and change it from “Next.js” to “Other”.

Note

I’m not very familiar with Vercel, so I used Claude to help identify potential causes for the log you shared.

@Andarist
Copy link
Copy Markdown
Member

Andarist commented May 5, 2026

Hitting curl https://changesets-1q76dtisl-changesets.vercel.app/api/webhook results with this in the deployment logs:

(node:4) Warning: Failed to load the ES module: /var/task/api/webhook.js. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4) Warning: Failed to load the ES module: /var/task/api/webhook.js. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension.
/var/task/api/webhook.js:1
import { createNodeMiddleware, createProbot } from "probot";
^^^^^^

Comment thread package.json
"homepage": "https://github.com/apps/changeset-bot",
"license": "MIT",
"repository": "https://github.com/changesets/bot",
"type": "module",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ts files are compiled to ESM but we don't have "type": "module", so probably the runtime is threading them as CJS so they error once they execute the first import.
Let's see if now works!

@Andarist
Copy link
Copy Markdown
Member

Andarist commented May 8, 2026

I fixed a couple of issues but now I'm running into this:

Error: [@octokit/auth-app] appId option is required
    at Object.createAppAuth (/var/task/node_modules/@octokit/auth-app/dist-node/index.js:492:11)
    at getState (/var/task/node_modules/octokit-auth-probot/dist-node/index.js:188:21)
    at createProbotAuth (/var/task/node_modules/octokit-auth-probot/dist-node/index.js:203:17)
    at new Octokit (/var/task/node_modules/@octokit/core/dist-node/index.js:113:20)
    at new OctokitWithDefaults (/var/task/node_modules/@octokit/core/dist-node/index.js:143:11)
    at new OctokitWithDefaults (/var/task/node_modules/@octokit/core/dist-node/index.js:143:11)
    at new Probot (/var/task/node_modules/probot/lib/probot.js:38:25)
    at createProbot (/var/task/node_modules/probot/lib/create-probot.js:54:12)
    at <anonymous> (/vercel/path0/api/webhook.ts:9:16)
    at ModuleJob.run (node:internal/modules/esm/module_job:343:25)

I guess Vercel no longer shares secrets through process.env in this new setup.

@Andarist
Copy link
Copy Markdown
Member

Andarist commented May 8, 2026

Actually, that's probably not it - it's just that those secrets are configured only for the production environment. I thiiiink I have enough proof to say this branch is good to go now. I don't have more time to deal with potential broken deployment fallout right now, so I'll have to land it later.

@marcalexiei
Copy link
Copy Markdown
Contributor Author

marcalexiei commented May 8, 2026

I don't have more time to deal with potential broken deployment fallout right now, so I'll have to land it later.

If you want to restore the deployment quickly, I also opened setup #107, which suppresses the TS deprecation error causing the next build to fail. It’s worth merging if you plan to deploy #111.


I thiiiink I have enough proof to say this branch is good to go now

I pushed two commits to refine your latest changes:

  • Drop node-fetch: Vercel should provide a Node runtime with the built-in fetch API available, so I removed both node-fetch and @types/node-fetch dependencies.
  • Enforce .ts extensions for internal imports: I noticed you added a .ts extension manually, so I updated the TypeScript module settings and added the import/extensions oxlint rule to enforce .ts extensions across all internal imports.

@Andarist Andarist merged commit af23c7e into changesets:master May 8, 2026
5 of 6 checks passed
@Andarist
Copy link
Copy Markdown
Member

Andarist commented May 8, 2026

@marcalexiei thanks!

@marcalexiei marcalexiei deleted the serverless branch May 9, 2026 03:41
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.

Update next.js

2 participants