Add Vercel configuration for API functions#3075
Conversation
📝 WalkthroughWalkthroughThis PR changes Drizzle Kit's migration output path to ChangesDeployment & migrations configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ 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
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
packages/db/drizzle.config.ts
| export default defineConfig({ | ||
| schema: "./src/schema/index.ts", | ||
| out: "../../migrations", | ||
| out: "./src/migrations", |
There was a problem hiding this comment.
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.
| 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.
There was a problem hiding this comment.
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.jsonwithincludeFilesfor function bundles. - Changes Drizzle migration output from the repo-level
migrations/directory topackages/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
migrationsfrom the web server output, so it will not discover migrations generated underpackages/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
/migrationsdirectory 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", |
| "includeFiles": "migrations/**" | ||
| }, | ||
| "index.mjs": { | ||
| "includeFiles": "migrations/**" |
| "functions": { | ||
| "api/**/*.js": { | ||
| "includeFiles": "migrations/**" | ||
| }, | ||
| "index.mjs": { | ||
| "includeFiles": "migrations/**" | ||
| } | ||
| } |
| "api/**/*.js": { | ||
| "includeFiles": "migrations/**" | ||
| }, | ||
| "index.mjs": { |
Summary by CodeRabbit