Discord Deployment Guide - Production Checklist

Complete guide for deploying Discord Activity to production


Pre-Deployment Checklist

Before deploying your Discord Activity, ensure:

  • Discord Application properly configured in Developer Portal

  • HTTPS domain with valid SSL certificate

  • Environment variables configured correctly

  • Database migrations applied

  • Bot commands registered (if using Discord bot)

  • Local testing completed successfully


Part 1: Discord Developer Portal Configuration

Step 1: Enable Activities Feature

  1. Select your application

  2. Navigate to General Information tab

  3. Scroll to Activity Settings

  4. Click Enable Activities (if not already enabled)

Step 2: Configure Activity URLs

In the Activity Settings section:

Activity URL:

Interactions Endpoint URL:

Important Notes:

  • Must use HTTPS (not HTTP)

  • No trailing slashes

  • Must match your actual domain exactly

  • Wait 1-2 minutes after saving for changes to propagate

Step 3: Set Up OAuth2

  1. Go to OAuth2General

  2. Note your Client ID and Client Secret

  3. Go to OAuth2URL Generator

  4. Under Redirects, add:

  1. Under OAuth2 Scopes, select:

    • identify

    • email

    • guilds

  2. Click Save Changes

Step 4: Get Your Public Key

  1. In General Information tab

  2. Copy Public Key (64-character hex string)

  3. Save for environment variables

Step 5: Verify Interactions Endpoint

Discord will automatically test your Interactions Endpoint:

  1. After setting the URL, Discord sends a PING request

  2. You should see a green checkmark appear

  3. If it fails:

    • Verify your API is deployed and accessible

    • Check that DISCORD_PUBLIC_KEY is set correctly

    • Ensure endpoint responds with { "type": 1 } for PING requests


Part 2: Environment Variables Configuration

Production Environment Variables

Create these environment variables in your hosting platform (Vercel, Netlify, Railway, etc.):

Frontend Variables

Backend Variables

Generating Secure Tokens


Part 3: Database Setup

Run Migrations

Ensure these tables exist in your database:

Set Up Cleanup Job

Old sessions and codes should be cleaned up automatically:

Or use a scheduled serverless function (Vercel Cron, etc.):


Part 4: Deploy Your Application

Vercel Deployment

Netlify Deployment

Railway Deployment

Docker Deployment


Part 5: Register Discord Bot Commands

If you're using a Discord bot for /verify command:

Option A: Via API Endpoint

Option B: Via Script

Option C: Manual Registration


Part 6: Testing in Production

Test Checklist

1. Test Activity Launch

2. Test Authentication

3. Test Account Linking

4. Test Bot /verify Command

5. Test Error Handling

Monitoring

Set up monitoring for:


Part 7: Troubleshooting

Issue: "Could not fetch application data"

Symptoms:

  • Activity doesn't load in Discord

  • Console error: 403 Forbidden on Discord API

Causes & Solutions:

  1. Activities not enabled:

    • Go to Discord Portal → General Information

    • Enable Activities feature

    • Set Activity URL

    • Wait 2 minutes

  2. Wrong Activity URL:

    • Verify URL matches your deployed domain exactly

    • Must use HTTPS

    • No trailing slash

  3. Domain not accessible:

    • Test: curl https://yourdomain.com/discord

    • Should return HTML, not error

Issue: "Session lost during OAuth"

Symptoms:

  • User redirected to login page after Discord authorization

  • Error: "session_lost"

Causes & Solutions:

  1. Redirect URI not registered:

    • Go to Discord Portal → OAuth2 → Redirects

    • Add: https://yourdomain.com/api/discord/oauth/callback

    • Wait 2 minutes

  2. Cookie domain mismatch:

    • Frontend domain: app.yourdomain.com

    • API domain: api.yourdomain.com

    • Cookies won't be sent cross-domain

    • Solution: Use same domain or set up CORS properly

  3. SameSite cookie issue:

Issue: "Interactions Endpoint verification failed"

Symptoms:

  • Red X next to Interactions Endpoint URL

  • Discord can't verify endpoint

Causes & Solutions:

  1. Endpoint not responding:

  2. DISCORD_PUBLIC_KEY not set:

    • Verify environment variable is set

    • Must be 64-character hex string

    • Restart server after setting

  3. Signature verification failing:

Issue: "Rate limited"

Symptoms:

  • HTTP 429 responses

  • Header: X-RateLimit-Remaining: 0

Solution:

Issue: "Discord account already linked"

Symptoms:

  • Error when trying to link Discord

  • Message: "This Discord account is already linked to another user"

Solution:

  1. User must unlink from previous account first

  2. Admin can manually unlink in database:

Issue: "Verification code expired"

Symptoms:

  • /verify code doesn't work

  • Error: "Code expired or invalid"

Solution:

  1. Codes expire after 5 minutes by design

  2. User should generate new code: /verify again

  3. Check database cleanup job is running:


Part 8: Security Best Practices

Secrets Management

Never commit secrets to git:

Use environment variables:

  • Vercel: Site Settings → Environment Variables

  • Netlify: Site Settings → Build & Deploy → Environment

  • Railway: Project → Variables

  • GitHub Actions: Repository → Settings → Secrets

Token Storage

Frontend (Client-side):

Backend (Server-side):

Rate Limiting

Implement rate limiting on sensitive endpoints:

Input Validation

Always validate user input:


Part 9: Performance Optimization

Caching Discord Data

Cache Discord user data to reduce API calls:

Database Connection Pooling

Use connection pooling for better performance:

CDN for Static Assets

Serve static assets from CDN:


Part 10: Monitoring & Logging

Set Up Error Tracking

Log Important Events

Health Check Endpoint


Part 11: Rollback Plan

If something goes wrong in production:

Quick Rollback

Database Rollback

Disable Discord Integration

If you need to temporarily disable:

  1. Discord Portal:

    • Disable Activities feature

    • This stops Activity from loading

  2. Application:


Summary

Deployment Steps:

  1. ✅ Configure Discord Developer Portal

  2. ✅ Set environment variables

  3. ✅ Run database migrations

  4. ✅ Deploy application

  5. ✅ Register bot commands (if applicable)

  6. ✅ Test all flows

  7. ✅ Set up monitoring

  8. ✅ Monitor for issues

Need Help?


Last Updated: January 7, 2026 Deployment Platform: Universal (Vercel, Netlify, Railway, Docker) Status: Production Ready

Last updated