Skip to content

Add Vercel configuration for API functions#3075

Closed
achrafsamih05 wants to merge 3 commits into
amruthpillai:mainfrom
achrafsamih05:main
Closed

Add Vercel configuration for API functions#3075
achrafsamih05 wants to merge 3 commits into
amruthpillai:mainfrom
achrafsamih05:main

Conversation

@achrafsamih05

@achrafsamih05 achrafsamih05 commented May 15, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Chores
    • Deployment configuration updated so generated migration files are bundled with serverless functions, improving release reliability.
    • Database tooling now emits generated migrations to a new package-local output directory, keeping migration artifacts organized and accessible.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR changes Drizzle Kit's migration output path to ./src/migrations and adds a functions block to vercel.json that sets includeFiles: "migrations/**" for api/**/*.js and index.mjs function entry patterns.

Changes

Deployment & migrations configuration

Layer / File(s) Summary
Drizzle Kit migration output path
packages/db/drizzle.config.ts
Updates the Drizzle Kit out setting from ../../migrations to ./src/migrations for generated migrations.
Vercel Functions configuration for function entry patterns
vercel.json
Adds a functions block matching api/**/*.js and index.mjs and sets includeFiles: "migrations/**" so migration files are bundled with those functions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit nibbles at the build,
Moves migrations, neat and skilled,
Bundles follow every track,
Quiet hops bring files back,
🐇📦✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions 'Vercel configuration for API functions', but the changes also include modifications to the Drizzle Kit configuration for migrations paths, which is not captured in the title. Consider whether the title should be more comprehensive to reflect both Vercel configuration and Drizzle migration path changes, or clarify if migrations are secondary.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/db/drizzle.config.ts`:
- Line 5: The Drizzle config's "out" path was changed to "./src/migrations"
which no longer matches Vercel's includeFiles glob "migrations/**" and can strip
migrations from the bundle; either revert the "out" value in the Drizzle config
back to "./migrations" so it matches the existing Vercel glob, or update
Vercel's includeFiles to include "packages/db/src/migrations/**" and also update
any runtime migration loader (the code that resolves/loads migrations) to use
the same path; in short, make the "out" key in drizzle.config.ts, the
vercel.json includeFiles glob, and your migration-loading logic use the
identical migrations path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ad219cb1-9ec1-4f28-a6ba-fffb115a0648

📥 Commits

Reviewing files that changed from the base of the PR and between f6d1cfe and fa8bc0e.

📒 Files selected for processing (1)
  • packages/db/drizzle.config.ts

export default defineConfig({
schema: "./src/schema/index.ts",
out: "../../migrations",
out: "./src/migrations",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Align migration output path with Vercel includeFiles glob.

Line 5 changes Drizzle output to packages/db/src/migrations, but the stack context says Vercel is configured to include migrations/**. This path mismatch can exclude migrations from serverless bundles and break runtime migration loading.

Suggested fix
-	out: "./src/migrations",
+	out: "../../migrations",

Or keep Line 5 as-is and update vercel.json to include packages/db/src/migrations/** (and ensure runtime migration lookup uses the same path).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
out: "./src/migrations",
out: "../../migrations",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/db/drizzle.config.ts` at line 5, The Drizzle config's "out" path was
changed to "./src/migrations" which no longer matches Vercel's includeFiles glob
"migrations/**" and can strip migrations from the bundle; either revert the
"out" value in the Drizzle config back to "./migrations" so it matches the
existing Vercel glob, or update Vercel's includeFiles to include
"packages/db/src/migrations/**" and also update any runtime migration loader
(the code that resolves/loads migrations) to use the same path; in short, make
the "out" key in drizzle.config.ts, the vercel.json includeFiles glob, and your
migration-loading logic use the identical migrations path.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to make database migrations available to Vercel serverless functions and reorganize Drizzle-generated migration output.

Changes:

  • Adds a root vercel.json with includeFiles for function bundles.
  • Changes Drizzle migration output from the repo-level migrations/ directory to packages/db/src/migrations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
vercel.json Adds Vercel function configuration intended to include migration files.
packages/db/drizzle.config.ts Changes the Drizzle migration generation output path.
Comments suppressed due to low confidence (2)

packages/db/drizzle.config.ts:5

  • The app's startup migrator resolves only an ancestor folder literally named migrations from the web server output, so it will not discover migrations generated under packages/db/src/migrations. Without updating that resolver or copying the new directory into the runtime layout, future schema migrations generated here will not run when the app starts.
	out: "./src/migrations",

packages/db/drizzle.config.ts:5

  • The production Docker image still copies only the repository-level /migrations directory into the runtime image, so migrations generated at this new package-local path would be absent from Docker deployments. Unless the Docker packaging is updated alongside this path change, schema changes generated after this PR will not be available in the shipped container.
	out: "./src/migrations",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export default defineConfig({
schema: "./src/schema/index.ts",
out: "../../migrations",
out: "./src/migrations",
Comment thread vercel.json
Comment on lines +4 to +7
"includeFiles": "migrations/**"
},
"index.mjs": {
"includeFiles": "migrations/**"
Comment thread vercel.json
Comment on lines +2 to +9
"functions": {
"api/**/*.js": {
"includeFiles": "migrations/**"
},
"index.mjs": {
"includeFiles": "migrations/**"
}
}
Comment thread vercel.json
Comment on lines +3 to +6
"api/**/*.js": {
"includeFiles": "migrations/**"
},
"index.mjs": {
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.

3 participants