Prettier format pending files

This commit is contained in:
Builder.io 2025-11-09 23:18:09 +00:00
parent b8aaf9895f
commit 05d05d87f6
2 changed files with 39 additions and 11 deletions

View file

@ -142,7 +142,10 @@ export default async function handler(req: any, res: any) {
);
}
} catch (err) {
console.log("[Discord OAuth] Could not check existing auth users:", err);
console.log(
"[Discord OAuth] Could not check existing auth users:",
err,
);
}
if (!userId_temp) {
@ -160,15 +163,12 @@ export default async function handler(req: any, res: any) {
});
if (authError || !authData.user) {
console.error(
"[Discord OAuth] Auth user creation failed:",
{
email: discordUser.email,
username: discordUser.username,
error_message: authError?.message,
error_code: authError?.code,
},
);
console.error("[Discord OAuth] Auth user creation failed:", {
email: discordUser.email,
username: discordUser.username,
error_message: authError?.message,
error_code: authError?.code,
});
return res.redirect(
`/login?error=auth_create&message=${encodeURIComponent(authError?.message || "Failed to create account")}`,
);

View file

@ -1,28 +1,34 @@
# Discord Activity Errors - Diagnostic & Fix Guide
## Problem
When opening Discord Activity, getting these errors:
```
GET https://discord.com/api/v9/application-directory-static/applications/578971245454950421?locale=en-US 403 (Forbidden)
Refused to display 'https://578971245454950421.discordsays.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'
```
## Root Cause
The Discord app is **NOT properly configured for Activities** in the Discord Developer Portal.
## Solution Checklist
### Step 1: Go to Discord Developer Portal
1. Visit: https://discord.com/developers/applications
2. Click on **"AeThex"** application
3. Go to the **"Activities"** tab on the left sidebar (NOT "General Information")
### Step 2: Enable Activities
1. If you don't see an "Activities" tab, the feature isn't enabled yet
2. Click **"Enable Activities"** or **"Configure"**
3. Fill in the required fields:
**Activity Settings:**
- **Activity Name**: `AeThex`
- **Preview Image**: Upload a 512x512px image (your app logo)
- **Description**: `AeThex Creator Network & Talent Platform - Activity`
@ -30,13 +36,17 @@ The Discord app is **NOT properly configured for Activities** in the Discord Dev
- **Terms of Service URL**: `https://aethex.dev/terms`
**Activity Instance Settings:**
- **Instance URL**: `https://aethex.dev/activity`
- **Enable this URL**: ✅ Check this box
### Step 3: Verify Manifest Configuration
The app must have a properly configured manifest. Check:
1. Manifest file exists at: `https://aethex.dev/discord-manifest.json`
2. Manifest contains:
```json
{
"id": "578971245454950421",
@ -56,21 +66,26 @@ The app must have a properly configured manifest. Check:
4. Should return valid JSON, not 404
### Step 4: Set Interactions Endpoint
Still in Discord Developer Portal:
1. Go to **"General Information"** tab
2. Under "Interactions Endpoint URL": `https://aethex.dev/api/discord/interactions`
3. Click **"Save"** (Discord will send PING to verify)
4. You should see: `✅ Interactions endpoint URL verified`
### Step 5: Check Bot Permissions
1. Go to **"OAuth2"** > **"URL Generator"**
2. Select these scopes:
- ✅ `applications.commands`
- ✅ `identify`
- ✅ `email`
- ✅ `guilds`
3. Select these permissions:
- ✅ `Send Messages`
- ✅ `Read Messages/View Channels`
- ✅ `Use Application Commands`
@ -78,7 +93,9 @@ Still in Discord Developer Portal:
4. Copy the generated URL and authorize the bot in your Discord server
### Step 6: Verify Bot Token
In Discord Developer Portal:
1. Go to **"Bot"** tab
2. Under "TOKEN", verify the token is:
- ✅ Not expired (if it shows "TOKEN EXPIRED", click "Reset Token")
@ -89,6 +106,7 @@ In Discord Developer Portal:
- ✅ Guild Members
### Step 7: Test the Activity
1. Open Discord
2. Go to any server where the bot is installed
3. Look for "Apps" section in the bottom left
@ -99,24 +117,28 @@ In Discord Developer Portal:
## If Still Getting Errors
### 403 Still Appears
- **Cause**: Activities might still not be fully enabled
- **Fix**: Wait 5-10 minutes for Discord to propagate settings, then retry
- **Alternative**: Try using a different Discord server to test
### X-Frame-Options Error Persists
- **Cause**: Discord's internal sandbox is rejecting the Activity
- **Fix**: Verify `instanceUrl` in Developer Portal matches exactly: `https://aethex.dev/activity`
- **Check**: Make sure Activity URL returns valid HTML, not redirects
### Activity Blank/Loading Forever
- **Cause**: `/api/discord/activity-auth` endpoint might be failing
- **Debug**:
- **Debug**:
1. Open browser console (F12)
2. Look for messages starting with `[Discord Activity]`
3. Check if auth endpoint is being called
4. Verify DISCORD_CLIENT_ID is set in environment
### Slash Commands Not Working in Activity
- **Cause**: Interactions endpoint not verified
- **Fix**: Ensure `https://aethex.dev/api/discord/interactions` is set and verified in Discord Developer Portal
@ -135,6 +157,7 @@ DISCORD_PUBLIC_KEY=<your_public_key>
Open browser console (F12) and look for these messages:
**✅ Success indicators:**
```
[Discord Activity] Initialization starting...
[Discord Activity] Creating SDK with clientId: 578971245454950421
@ -144,6 +167,7 @@ Open browser console (F12) and look for these messages:
```
**❌ Error indicators:**
```
[Discord Activity] Authorizing user...
[Discord Activity] Got access token, calling activity-auth...
@ -153,17 +177,21 @@ ERROR: 403 Forbidden
## Quick Verification Steps
1. **Check manifest is accessible:**
```bash
curl https://aethex.dev/discord-manifest.json
```
Should return valid JSON
2. **Check interactions endpoint:**
```bash
curl -X POST https://aethex.dev/api/discord/interactions \
-H "Content-Type: application/json" \
-d '{"type":1}'
```
Should return a response (not 404/500)
3. **Check bot token:**