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