搭配 Web 框架部署
Mastra 與 Web 框架整合後,會使用該框架的標準部署流程,隨應用程式一同部署。請依照下列說明,確保 Mastra 整合能正確部署。
警告
若要部署至雲端供應商,請從 Mastra 設定中移除所有 LibSQLStore 用法。LibSQLStore 需要存取檔案系統,與無伺服器平台不相容。
整合指南:
在 Vercel 上搭配 Next.js「在 Vercel 上搭配 Next.js」的直接連結
如果你已依照指南將 Mastra 與 Next.js 整合,並打算部署至 Vercel,請在 next.config.ts 中加入 serverExternalPackages: ["@mastra/*"]:
next.config.ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
serverExternalPackages: ['@mastra/*'],
}
export default nextConfig
在 Vercel 上搭配 Astro「在 Vercel 上搭配 Astro」的直接連結
如果你已依照指南將 Mastra 與 Astro 整合,並打算部署至 Vercel,請在 astro.config.mjs 中加入 Vercel adapter 與伺服器輸出:
astro.config.mjs
import { defineConfig } from 'astro/config'
import vercel from '@astrojs/vercel'
export default defineConfig({
adapter: vercel(),
output: 'server',
})
在 Netlify 上搭配 Astro「在 Netlify 上搭配 Astro」的直接連結
如果你已依照指南將 Mastra 與 Astro 整合,並打算部署至 Netlify,請在 astro.config.mjs 中加入 Netlify adapter 與伺服器輸出:
astro.config.mjs
import { defineConfig } from 'astro/config'
import netlify from '@astrojs/netlify'
export default defineConfig({
adapter: netlify(),
output: 'server',
})