Discord Activity Troubleshooting Guide
Error: 403 Forbidden on Directory API + X-Frame-Options Error
Symptoms
Discord Activity shows blank screen
Browser console shows:
GET https://discord.com/api/v9/application-directory-static/applications/578971245454950421?locale=en-US 403 (Forbidden)Browser console shows:
Refused to display 'https://578971245454950421.discordsays.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'
Root Causes
Activities feature not enabled in Discord Developer Portal
Activity URL not configured in Discord Developer Portal
Interactions Endpoint URL not set or not responding correctly
Missing OAuth2 configuration for Activity scopes
Solution: Step-by-Step Configuration
Step 1: Enable Activities Feature
Go to Discord Developer Portal
Click on your app: AeThex (ID:
578971245454950421)Navigate to General Information tab
Scroll to Activity Settings section
Look for "Enable Activities" button/toggle
If you see it, click to enable
If Activities is already enabled, proceed to Step 2
Step 2: Configure Activity URL
In Activity Settings, you should now see:
Activity URL field
Set it to:
https://aethex.dev/activity
Interactions Endpoint URL:
Set to:
https://aethex.dev/api/discord/interactions
Instance URL (if present):
Set to:
https://aethex.dev
Click Save
Wait 1-2 minutes for Discord to process the configuration
Step 3: Verify Interactions Endpoint
Discord will test your Interactions Endpoint by sending a PING request.
Expected behavior:
You should see a green checkmark next to the Interactions Endpoint URL
If it fails, check:
Is
https://aethex.dev/api/discord/interactionsresponding?Is
DISCORD_PUBLIC_KEYset in your environment?Run this to test:
curl -X POST https://aethex.dev/api/discord/interactions -H "Content-Type: application/json" -d '{}'
Step 4: Check OAuth2 Settings
Go to OAuth2 → General
Verify Client ID:
578971245454950421Ensure Client Secret is populated
Go to OAuth2 → Scopes
Check that at least these scopes are selected:
✅
identify✅
guilds
Step 5: Test the Activity
Add your bot to a test Discord server:
Go to OAuth2 → URL Generator
Select scopes:
bot,applications.commandsCopy the generated URL and open it in browser
In Discord, right-click your bot and select "Apps" → "AeThex Activity"
The Activity should open in a modal
Check browser console for any errors (press
F12)
Debugging Checklist
Server-Side Checks
1. Verify Interactions Endpoint is Responding
2. Check DISCORD_PUBLIC_KEY is Set
3. Check X-Frame-Options Headers
Client-Side Checks
1. Open Browser Console (F12)
Look for
[Discord Activity]log messagesThey should show:
Initialization starting...Creating SDK with clientId: 578971245454950421SDK is readyEither
Current user: existsorAuthorizing user...
2. Check frame_id Parameter
When inside Discord Activity, the URL should contain
?frame_id=...If no
frame_id, Discord hasn't launched the Activity properlyThis usually means the Activity URL is misconfigured
3. Check Discord SDK Loading
The Discord SDK should load from:
https://cdn.discordapp.com/assets/embedded/lazyload.min.jsIf this fails, check your CORS settings or ISP blocks
Common Issues & Solutions
Issue 1: "Not in Discord Activity context (no frame_id)"
Cause: Discord is not launching the Activity with the required parameter
Solution:
Verify Activity URL is set to:
https://aethex.dev/activity(exactly)Wait 5 minutes for Discord to cache the configuration
Try again in Discord
Issue 2: "Failed to initialize Discord Activity"
Cause: Discord SDK failed to initialize or authorize
Solution:
Check browser console for specific error message
Verify
VITE_DISCORD_CLIENT_ID=578971245454950421is setEnsure
identifyscope is selected in OAuth2 settingsTry opening Activity in an incognito window (clear cache)
Issue 3: "X-Frame-Options: sameorigin" Error
Cause: Server is sending restrictive frame headers
Solution:
Verify
/api/discord/interactionsendpoint exists and is reachableCheck that
X-Frame-Options: ALLOWALLis being set (line 159 of code/server/index.ts)Check that
Access-Control-Allow-Origin: *is being setRestart the server to apply header changes
Issue 4: 403 Forbidden on Directory API
Cause: Discord can't validate your app configuration
Solution:
Ensure Activities feature is fully enabled
Wait 10 minutes after changing any settings
Clear browser cache (Ctrl+Shift+Delete)
Try in a different browser
Contact Discord support if issue persists
Testing Activity in Development
Using Discord's Embedded Test
Go to your app's Activity Settings
Click "Test Activity" or "Preview" button
Activity should open in a modal window
Check console (F12) for errors
Using a Test Server
Create a private Discord server
Add bot to the server
Right-click bot name → Apps → Select your activity
Activity modal should open
Environment Variables to Verify
On your hosting platform (Vercel, Railway, etc.), ensure these are set:
⚠️ CRITICAL SECURITY WARNING:
NEVER include real tokens, secrets, or keys in documentation
NEVER commit these to git or public repositories
Only set these values in your hosting platform's environment variables dashboard
Get these values from: Discord Developer Portal > Your App
Still Not Working?
Check the logs: Look at your hosting platform's logs for errors
Check browser console: Press F12 and look for
[Discord Activity]messagesVerify Discord Portal: Screenshot your Activity Settings to confirm configuration
Test endpoint manually: Try
curl -v https://aethex.dev/api/discord/interactionsClear everything: Clear browser cache, restart bot, wait 10 minutes, try again
Discord Developer Portal Checklist
Last updated
