This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

remove errors

+54 -109
+2 -24
app/src/app/api/bluesky/flushing/route.ts
··· 8 8 try { 9 9 const { accessToken, dpopToken, did, text, emoji, pdsEndpoint } = await request.json(); 10 10 11 - console.log('API received pdsEndpoint:', pdsEndpoint); 12 - 13 11 if (!accessToken || !dpopToken || !did || !text || !emoji) { 14 12 return NextResponse.json( 15 13 { error: 'Missing required parameters' }, ··· 26 24 } 27 25 28 26 const apiUrl = `${pdsEndpoint}/xrpc`; 29 - console.log('Using API URL:', apiUrl); 30 27 31 28 // Create the record 32 29 const record = { ··· 42 39 record 43 40 }; 44 41 45 - // Debug the request 46 - console.log('Creating record with body:', JSON.stringify(body)); 47 - 48 - // Log the request headers for debugging 49 - const requestHeaders = { 50 - 'Content-Type': 'application/json', 51 - 'Authorization': `DPoP ${accessToken.substring(0, 10)}...`, 52 - 'DPoP': `${dpopToken.substring(0, 10)}...`, 53 - }; 54 - console.log('Request headers:', JSON.stringify(requestHeaders)); 42 + // We're creating a record with the user's credentials 55 43 56 44 // We're now doing nonce handling on the client side 57 45 ··· 66 54 body: JSON.stringify(body) 67 55 }); 68 56 69 - // Log response headers for debugging 70 - const responseHeaders: Record<string, string> = {}; 71 - response.headers.forEach((value, key) => { 72 - responseHeaders[key] = value; 73 - }); 74 - console.log('Response headers:', JSON.stringify(responseHeaders)); 75 - 76 - // Debug the response 77 - console.log('Create record response status:', response.status); 57 + // Process the response 78 58 let responseText = ''; 79 59 let responseData: Record<string, any> = {}; 80 60 81 61 try { 82 62 responseText = await response.text(); 83 - console.log('Create record response:', responseText); 84 63 85 64 // Try to parse the response as JSON if it's not empty 86 65 if (responseText) { ··· 99 78 const newNonce = response.headers.get('DPoP-Nonce'); 100 79 101 80 if (newNonce) { 102 - console.log('Received new DPoP nonce from PDS:', newNonce); 103 81 return NextResponse.json({ 104 82 error: 'use_dpop_nonce', 105 83 nonce: newNonce,
-3
app/src/app/api/bluesky/profile/route.ts
··· 21 21 if (handle && handle.startsWith('did:')) { 22 22 // If it's a DID, use describeRepo to get details 23 23 url = `${apiUrl}/com.atproto.repo.describeRepo?repo=${encodeURIComponent(handle)}`; 24 - console.log('Looking up account info by DID:', handle); 25 24 } else { 26 25 // Otherwise treat it as a handle to resolve 27 26 const userHandle = handle || 'atproto.com'; 28 27 url = `${apiUrl}/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(userHandle)}`; 29 - console.log('Looking up account info by handle:', userHandle); 30 28 } 31 - console.log('Making request to:', url); 32 29 33 30 const response = await fetch(url, { 34 31 method: 'GET',
+7 -20
app/src/app/auth/callback/page.tsx
··· 28 28 const [error, setError] = useState<string | null>(null); 29 29 const [status, setStatus] = useState('Processing login...'); 30 30 const [isClient, setIsClient] = useState(false); 31 + const [processed, setProcessed] = useState(false); // Track if we've already processed the callback 31 32 32 33 // Set isClient to true once component mounts 33 34 useEffect(() => { ··· 35 36 }, []); 36 37 37 38 useEffect(() => { 38 - // Only proceed if we're on the client side 39 - if (!isClient) return; 39 + // Only proceed if we're on the client side and haven't processed the callback yet 40 + if (!isClient || processed) return; 41 + 42 + // Mark as processed immediately to prevent duplicate processing 43 + setProcessed(true); 40 44 41 45 async function handleCallback() { 42 46 try { ··· 60 64 const codeVerifier = retrieveAuthData('code_verifier'); 61 65 const serializedKeyPair = retrieveAuthData('key_pair'); 62 66 63 - console.log('Callback received state:', state?.substring(0, 5) + '...'); 64 - console.log('Stored state:', storedState?.substring(0, 5) + '...'); 65 - 66 67 // Check if we have the stored values 67 68 if (!storedState) { 68 - console.error('No stored OAuth state found. Browser storage may have been cleared.'); 69 69 setError('Session data lost. Please try logging in again.'); 70 70 return; 71 71 } ··· 133 133 134 134 setStatus('Getting user profile...'); 135 135 136 - // Extract the PDS endpoint from the token audience 137 - let pdsEndpoint = null; 138 - console.log('Token audience:', tokenResponse.aud); 139 - if (tokenResponse.aud && typeof tokenResponse.aud === 'string') { 140 - if (tokenResponse.aud.startsWith('did:web:')) { 141 - // Convert did:web:example.com to https://example.com 142 - pdsEndpoint = 'https://' + tokenResponse.aud.replace('did:web:', ''); 143 - console.log('Extracted PDS endpoint from token:', pdsEndpoint); 144 - } else { 145 - console.warn('Token audience does not start with did:web:', tokenResponse.aud); 146 - } 147 - } else { 148 - console.warn('Token audience missing or not a string:', tokenResponse.aud); 149 - } 136 + // We'll extract the PDS endpoint from the decoded token 150 137 151 138 // Get user profile 152 139 let profileResponse;
+5 -11
app/src/lib/bluesky-api.ts
··· 225 225 pdsEndpoint: string | null = null 226 226 ): Promise<any> { 227 227 try { 228 - console.log('Getting profile via proxy API'); 229 - 230 228 // Generate a DPoP token for the profile request 231 229 const publicKey = await exportJWK(keyPair.publicKey); 232 230 // Use the PDS endpoint if available ··· 237 235 if (handle && handle.startsWith('did:')) { 238 236 // If it's a DID, use the describeRepo endpoint 239 237 endpoint = `${baseUrl}/com.atproto.repo.describeRepo?repo=${encodeURIComponent(handle)}`; 240 - console.log('Looking up profile by DID:', handle); 241 238 } else { 242 239 // Otherwise use resolveHandle for handles 243 240 endpoint = `${baseUrl}/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(handle)}`; 244 - console.log('Looking up profile by handle:', handle); 245 241 } 246 242 247 243 // Generate the DPoP token with the access token for the ath claim ··· 302 298 throw new Error('Maximum retry attempts reached. Could not create status after 3 attempts.'); 303 299 } 304 300 305 - console.log(`Creating flushing status (attempt ${retryCount + 1}/3) with nonce:`, dpopNonce); 306 - console.log('Using PDS endpoint:', pdsEndpoint || 'default'); 301 + // Preparing to create status record (attempt ${retryCount + 1}) 307 302 308 303 try { 309 304 // Validate inputs ··· 320 315 const baseUrl = pdsEndpoint ? `${pdsEndpoint}/xrpc` : 'https://bsky.social/xrpc'; 321 316 const endpoint = `${baseUrl}/com.atproto.repo.createRecord`; 322 317 323 - console.log('API endpoint:', endpoint); 318 + // Endpoint is set 324 319 325 320 // Generate a DPoP token for the create request 326 321 const publicKey = await exportJWK(keyPair.publicKey); ··· 337 332 ); 338 333 339 334 // Make the request via our proxy API 340 - console.log('Sending request to proxy API...'); 335 + // Sending request 341 336 const response = await fetch('/api/bluesky/flushing', { 342 337 method: 'POST', 343 338 headers: { ··· 355 350 356 351 // Handle response 357 352 if (response.ok) { 358 - console.log('Status update successful!'); 359 353 return await response.json(); 360 354 } 361 355 362 356 const errorData = await response.json().catch(() => ({})); 363 - console.error('Status creation error:', errorData); 364 357 365 358 // Handle nonce error with retry 366 359 if (response.status === 401 && errorData.error === 'use_dpop_nonce' && errorData.nonce) { 367 - console.log('Received DPoP nonce error, retrying with nonce:', errorData.nonce); 360 + // This is normal operation - DPoP requires a nonce exchange 361 + console.log('Received nonce from server, retrying request'); 368 362 369 363 // Retry with the new nonce and increment retry counter 370 364 return createFlushingStatus(
+40 -51
contextual info for claude/app_errors.md
··· 3 3 https://flushing.im/favicon.ico 4 4 [HTTP/2 404 0ms] 5 5 6 - Callback received state: sKbxR... page-a2b4c23153d80106.js:1:993 7 - Stored state: sKbxR... page-a2b4c23153d80106.js:1:1073 8 - Exchanging code for token... page-a2b4c23153d80106.js:1:1914 9 - No nonce provided, getting one from API... 481-38cee1d3cffbeb60.js:1:8815 10 - Obtained nonce from API: jEDudu85YaVxa83p3YzTLY4VYmRv2O6VpyOwSkZtXu8 481-38cee1d3cffbeb60.js:1:8892 11 - Creating DPoP token with nonce: jEDudu85YaVxa83p3YzTLY4VYmRv2O6VpyOwSkZtXu8 481-38cee1d3cffbeb60.js:1:9004 12 - Making token request via proxy API 481-38cee1d3cffbeb60.js:1:9143 13 - Token request successful 481-38cee1d3cffbeb60.js:1:9636 14 - Token audience: undefined page-a2b4c23153d80106.js:1:2266 15 - Token audience missing or not a string: undefined page-a2b4c23153d80106.js:1:2524 16 - Getting profile via proxy API 481-38cee1d3cffbeb60.js:1:3562 17 - Adding ath claim to DPoP token 481-38cee1d3cffbeb60.js:1:6994 18 - Token response: 19 - Object { access_token: "eyJ0eXAiOiJhdCtqd3QiLCJhbGciOiJFUzI1NksifQ.eyJhdWQiOiJkaWQ6d2ViOmVub2tpLnVzLWVhc3QuaG9zdC5ic2t5Lm5ldHdvcmsiLCJpYXQiOjE3NDEzOTEwMzUsImV4cCI6MTc0MTM5NDYzNSwic3ViIjoiZGlkOnBsYzpncTRmbzN1NnRxenpka2psd3pwYjIzdGoiLCJqdGkiOiJ0b2stMDU0ZTAyMjI4MTcxYTNlMDcyYTNhODQ0Y2I4Njk1YTciLCJjbmYiOnsiamt0IjoiNVltV1k3SE5zM3BGdFVEd1VlaGlpbkxEYXdXR1Z3VXU5dUNEZUxmVURhSSJ9LCJjbGllbnRfaWQiOiJodHRwczovL2ZsdXNoaW5nLmltL2NsaWVudC1tZXRhZGF0YS5qc29uIiwic2NvcGUiOiJhdHByb3RvIHRyYW5zaXRpb246Z2VuZXJpYyIsImlzcyI6Imh0dHBzOi8vYnNreS5zb2NpYWwifQ.k6Z977hSzPqhljN1wje06apxn_uBxZajHWiSCulboe4kxCOrn_iHUd7-ANMXo2YwSGz5rQL-t-KeZv-IKyBzlw", token_type: "DPoP", refresh_token: "ref-d556158ae379dd4dae168f84b27a214c2a8e044d506d95c9f4c5ec8c25dca656", scope: "atproto transition:generic", expires_in: 3599, sub: "did:plc:gq4fo3u6tqzzdkjlwzpb23tj" } 20 - page-a2b4c23153d80106.js:1:2781 21 - User DID from token: did:plc:gq4fo3u6tqzzdkjlwzpb23tj page-a2b4c23153d80106.js:1:2826 22 - Decoded token payload: 23 - Object { aud: "did:web:enoki.us-east.host.bsky.network", iat: 1741391035, exp: 1741394635, sub: "did:plc:gq4fo3u6tqzzdkjlwzpb23tj", jti: "tok-054e02228171a3e072a3a844cb8695a7", cnf: {…}, client_id: "https://flushing.im/client-metadata.json", scope: "atproto transition:generic", iss: "https://bsky.social" } 24 - page-a2b4c23153d80106.js:1:2976 25 - Audience from decoded token: did:web:enoki.us-east.host.bsky.network page-a2b4c23153d80106.js:1:3048 26 - Extracted PDS endpoint from decoded token: https://enoki.us-east.host.bsky.network page-a2b4c23153d80106.js:1:3171 27 - Using PDS endpoint for API requests: https://enoki.us-east.host.bsky.network page-a2b4c23153d80106.js:1:3431 28 - Saving PDS endpoint to auth context: https://enoki.us-east.host.bsky.network page-a2b4c23153d80106.js:1:3485 29 - Callback received state: sKbxR... page-a2b4c23153d80106.js:1:993 30 - Stored state: undefined... page-a2b4c23153d80106.js:1:1073 31 - No stored OAuth state found. Browser storage may have been cleared. 117-9a2b9731dac7965d.js:1:4081 6 + Callback received state: wljhb... page-60ffa11c049607bc.js:1:993 7 + Stored state: wljhb... page-60ffa11c049607bc.js:1:1073 8 + Exchanging code for token... page-60ffa11c049607bc.js:1:1914 9 + No nonce provided, getting one from API... 481-2dfa6219a8f21f6a.js:1:8851 10 + Obtained nonce from API: 9DpBC732hMV3debYUi33tyx-RbrwdWgXi9KaVlQM55I 481-2dfa6219a8f21f6a.js:1:8928 11 + Creating DPoP token with nonce: 9DpBC732hMV3debYUi33tyx-RbrwdWgXi9KaVlQM55I 481-2dfa6219a8f21f6a.js:1:9040 12 + Making token request via proxy API 481-2dfa6219a8f21f6a.js:1:9179 13 + Token request successful 481-2dfa6219a8f21f6a.js:1:9672 14 + Token audience: undefined page-60ffa11c049607bc.js:1:2266 15 + Token audience missing or not a string: undefined page-60ffa11c049607bc.js:1:2524 16 + Getting profile via proxy API 481-2dfa6219a8f21f6a.js:1:3568 17 + Looking up profile by handle: atproto.com 481-2dfa6219a8f21f6a.js:1:3945 18 + User DID from token: did:plc:gq4fo3u6tqzzdkjlwzpb23tj page-60ffa11c049607bc.js:1:2789 19 + Extracted PDS endpoint from decoded token: https://enoki.us-east.host.bsky.network page-60ffa11c049607bc.js:1:3043 20 + Getting user handle from DID... page-60ffa11c049607bc.js:1:3334 21 + Getting profile via proxy API 481-2dfa6219a8f21f6a.js:1:3568 22 + Looking up profile by DID: did:plc:gq4fo3u6tqzzdkjlwzpb23tj 481-2dfa6219a8f21f6a.js:1:3808 23 + Successfully resolved user handle: dame.is page-60ffa11c049607bc.js:1:3450 24 + Using PDS endpoint for API requests: https://enoki.us-east.host.bsky.network page-60ffa11c049607bc.js:1:3586 25 + Saving PDS endpoint to auth context: https://enoki.us-east.host.bsky.network page-60ffa11c049607bc.js:1:3640 26 + Callback received state: wljhb... page-60ffa11c049607bc.js:1:993 27 + Stored state: undefined... page-60ffa11c049607bc.js:1:1073 28 + No stored OAuth state found. Browser storage may have been cleared. 117-4cdef2a370a17db4.js:1:4081 32 29 Submitting status update with DID: did:plc:gq4fo3u6tqzzdkjlwzpb23tj page-1f5ea258c75e5bac.js:1:1200 33 30 Using PDS endpoint: https://enoki.us-east.host.bsky.network page-1f5ea258c75e5bac.js:1:1252 34 - Checking auth with PDS endpoint: https://enoki.us-east.host.bsky.network 481-38cee1d3cffbeb60.js:1:2469 35 - Adding ath claim to DPoP token 481-38cee1d3cffbeb60.js:1:6994 36 - Making auth check request to: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.identity.resolveHandle?handle=atproto.com 481-38cee1d3cffbeb60.js:1:2711 37 - Auth check successful! 481-38cee1d3cffbeb60.js:1:2858 31 + Checking auth with PDS endpoint: https://enoki.us-east.host.bsky.network 481-2dfa6219a8f21f6a.js:1:2469 32 + Making auth check request to: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.identity.resolveHandle?handle=atproto.com 481-2dfa6219a8f21f6a.js:1:2711 33 + Auth check successful! 481-2dfa6219a8f21f6a.js:1:2858 38 34 Authentication verified, creating status... page-1f5ea258c75e5bac.js:1:1662 39 - Creating flushing status (attempt 1/3) with nonce: null 481-38cee1d3cffbeb60.js:1:4530 40 - Using PDS endpoint: https://enoki.us-east.host.bsky.network 481-38cee1d3cffbeb60.js:1:4612 41 - API endpoint: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord 481-38cee1d3cffbeb60.js:1:4989 42 - Generating DPoP token for: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord with nonce: none 481-38cee1d3cffbeb60.js:1:5054 43 - Including access token hash (ath) in DPoP token 481-38cee1d3cffbeb60.js:1:5122 44 - Adding ath claim to DPoP token 481-38cee1d3cffbeb60.js:1:6994 45 - Sending request to proxy API... 481-38cee1d3cffbeb60.js:1:5243 35 + Creating flushing status (attempt 1/3) with nonce: null 481-2dfa6219a8f21f6a.js:1:4747 36 + Using PDS endpoint: https://enoki.us-east.host.bsky.network 481-2dfa6219a8f21f6a.js:1:4829 37 + API endpoint: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord 481-2dfa6219a8f21f6a.js:1:5206 38 + Sending request to proxy API... 481-2dfa6219a8f21f6a.js:1:5325 46 39 XHRPOST 47 40 https://flushing.im/api/bluesky/flushing 48 - [HTTP/2 401 203ms] 41 + [HTTP/2 401 185ms] 49 42 50 43 Status creation error: 51 - Object { error: "use_dpop_nonce", nonce: "nceSKdZmf25ZbombMTLHUIw9I0Ss1PobvE6nqZOKAR0", originalError: {…} } 52 - 117-9a2b9731dac7965d.js:1:4081 53 - NextJS 32 54 - Received DPoP nonce error, retrying with nonce: nceSKdZmf25ZbombMTLHUIw9I0Ss1PobvE6nqZOKAR0 481-38cee1d3cffbeb60.js:1:5689 55 - Creating flushing status (attempt 2/3) with nonce: nceSKdZmf25ZbombMTLHUIw9I0Ss1PobvE6nqZOKAR0 481-38cee1d3cffbeb60.js:1:4530 56 - Using PDS endpoint: https://enoki.us-east.host.bsky.network 481-38cee1d3cffbeb60.js:1:4612 57 - API endpoint: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord 481-38cee1d3cffbeb60.js:1:4989 58 - Generating DPoP token for: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord with nonce: nceSKdZmf25ZbombMTLHUIw9I0Ss1PobvE6nqZOKAR0 481-38cee1d3cffbeb60.js:1:5054 59 - Including access token hash (ath) in DPoP token 481-38cee1d3cffbeb60.js:1:5122 60 - Adding ath claim to DPoP token 481-38cee1d3cffbeb60.js:1:6994 61 - Sending request to proxy API... 481-38cee1d3cffbeb60.js:1:5243 62 - Status update successful! 481-38cee1d3cffbeb60.js:1:5492 44 + Object { error: "use_dpop_nonce", nonce: "ZzP4OW52NUitqfzMIq5Ww_QPmZDKEmZBIkXHtvdkpNQ", originalError: {…} } 45 + 117-4cdef2a370a17db4.js:1:4081 46 + Received DPoP nonce error, retrying with nonce: ZzP4OW52NUitqfzMIq5Ww_QPmZDKEmZBIkXHtvdkpNQ 481-2dfa6219a8f21f6a.js:1:5771 47 + Creating flushing status (attempt 2/3) with nonce: ZzP4OW52NUitqfzMIq5Ww_QPmZDKEmZBIkXHtvdkpNQ 481-2dfa6219a8f21f6a.js:1:4747 48 + Using PDS endpoint: https://enoki.us-east.host.bsky.network 481-2dfa6219a8f21f6a.js:1:4829 49 + API endpoint: https://enoki.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord 481-2dfa6219a8f21f6a.js:1:5206 50 + Sending request to proxy API... 481-2dfa6219a8f21f6a.js:1:5325 51 + Status update successful! 481-2dfa6219a8f21f6a.js:1:5574 63 52 Status update result: 64 - Object { uri: "at://did:plc:gq4fo3u6tqzzdkjlwzpb23tj/im.flushing.right.now/3ljt6tf5x4l2h", cid: "bafyreihsj6n5u72js5zfibc56ng2qpmglrljmjfx7aabyr3sogwwx5jm4q", commit: {…}, validationStatus: "unknown" } 53 + Object { uri: "at://did:plc:gq4fo3u6tqzzdkjlwzpb23tj/im.flushing.right.now/3ljt7a3lfwh2s", cid: "bafyreigryxavwcjkdzuo3wt5przffjkxwmbk5p6krlmfspb3kmjee3erwa", commit: {…}, validationStatus: "unknown" } 65 54 page-1f5ea258c75e5bac.js:1:1763