Switching adapters
An adapter connects your app to a host. Your handlers stay the same on every
host. Only discord0.config.ts changes.
| Adapter | Host | init --adapter |
|---|---|---|
@discord0/adapter-cloudflare |
Cloudflare Workers | cloudflare (default) |
@discord0/adapter-vercel |
Vercel Functions | vercel |
@discord0/adapter-netlify |
Netlify Functions | netlify |
@discord0/adapter-aws |
AWS Lambda with a Function URL | aws |
@discord0/adapter-node |
A Node.js server you run yourself | node |
@discord0/adapter-bun |
A Bun.serve server you run yourself |
bun |
Switch an existing project
Section titled “Switch an existing project”-
Install the new adapter as a dev dependency:
Terminal window npm install -D @discord0/adapter-vercel -
Import it in
discord0.config.tsinstead of the old one:discord0.config.ts import adapter from "@discord0/adapter-vercel";import { defineConfig } from "discord0";export default defineConfig({adapter: adapter(),guild: process.env.DISCORD_GUILD_ID,}); -
Remove the old adapter if you no longer need it:
Terminal window npm uninstall @discord0/adapter-cloudflare -
Set your credentials with the new provider, deploy, and update the Interactions Endpoint URL in the Developer Portal. If the app handles webhook events, update the Webhook Events URL too. Deploy covers each host.
If your handlers run for more than a few seconds, check the new host’s deferred-work limit before you switch.
Deploy to another host once
Section titled “Deploy to another host once”To try a host without changing the config, pass its name to deploy:
npm install -D @discord0/adapter-netlifynpx discord0 deploy netlifydeploy <name> loads @discord0/adapter-<name> from your project’s
node_modules, so install the adapter first.