Skip to content

Commit bfc58cc

Browse files
authored
fix(vercel): use /tmp directory for sqlite db (#3108)
1 parent 1b53fe8 commit bfc58cc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/presets/vercel.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import nodePreset from './node'
44

55
export default definePreset({
66
name: 'vercel',
7+
async setup(options) {
8+
options.database ||= { type: 'sqlite', filename: '/tmp/contents.sqlite' }
9+
},
710
async setupNitro(nitroConfig, options) {
8-
if (nitroConfig.runtimeConfig?.content?.database?.type === 'sqlite') {
9-
logger.warn('Deploying sqlite database to Vercel is not recommended if you are not prerendering your site.')
10-
logger.info('We recommend using a hosted SQL database like Neon, Turso, Supabase or others.')
11+
const database = nitroConfig.runtimeConfig?.content?.database
12+
if (database?.type === 'sqlite' && !database?.filename?.startsWith('/tmp')) {
13+
logger.warn('Deploying sqlite database to Vercel is possible only in `/tmp` directory. Using `/tmp/contents.sqlite` instead.')
14+
database.filename = '/tmp/contents.sqlite'
1115
}
1216

1317
await nodePreset.setupNitro(nitroConfig, options)

0 commit comments

Comments
 (0)