Applying drizzle migrations on Vercel with Hono

Hi, I'm trying to apply that migrations on the directory like this:
await migrate(drizzleDb, {
migrationsFolder: "./src/databases/tenants/migrations",
})
await migrate(drizzleDb, {
migrationsFolder: "./src/databases/tenants/migrations",
})
I'm using Nextjs, deployed on Vercel with a hono api. The path is /api/hono/tenants/create. But every time I get this error: Error: Can't find meta/_journal.json file at /var/task/.next/server/app/api/hono/[[...route]]/route.js:2467:42887 at qp (/var/task/.next/server/app/api/hono/[[...route]]/route.js:2467:43323) at /var/task/.next/server/app/api/hono/[[...route]]/route.js:2467:44022 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async o (/var/task/.next/server/chunks/636.js:67:10412) at async Function.P [as begin] (/var/task/.next/server/chunks/636.js:67:9981) at async qf (/var/task/.next/server/app/api/hono/[[...route]]/route.js:2467:43460) I have tried absolute urls, relative, using path.join, etc. Thanks for the help 😄
1 Reply
Gary, el Pingüino Artefacto
After some hours, I managed to solve it. For anyone with the same issue, use the path module.
const folder = path.join(process.cwd(), "src", "databases", "tenants", "migrations")
const folder = path.join(process.cwd(), "src", "databases", "tenants", "migrations")
I also added this on the next.conf, Idk if it is necesary but xd
experimental: {
outputFileTracingIncludes: {
"/api/hono/[[...routes]]": ["./src/databases/tenants/migrations/**/*"],
"/api/hono/tenants/create": ["./src/databases/tenants/migrations/**/*"],
},
},
experimental: {
outputFileTracingIncludes: {
"/api/hono/[[...routes]]": ["./src/databases/tenants/migrations/**/*"],
"/api/hono/tenants/create": ["./src/databases/tenants/migrations/**/*"],
},
},
and
webpack: (config, { isServer }) => {
if (isServer) {
if (process.env.VERCEL_ENV === "production") {
execSync(`curl -X GET ${process.env.VERCEL_URL}/api/hono/tenant/create`)
}
}
return config
},
webpack: (config, { isServer }) => {
if (isServer) {
if (process.env.VERCEL_ENV === "production") {
execSync(`curl -X GET ${process.env.VERCEL_URL}/api/hono/tenant/create`)
}
}
return config
},
Want results from more Discord servers?
Add your server