From d3836989ea602485035a296a64dc7adcc03c7e89 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Sun, 27 Sep 2026 07:49:30 -0400 Subject: [PATCH] debug(sync): logs serveur yt-history/WL (counts + detail erreur) --- server/index.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/index.mjs b/server/index.mjs index 614cd07..42cf0d7 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -673,6 +673,9 @@ r.get('/oauth/google/watchlater', authMiddlewareCookieAware, oauthLimiter, async console.warn(`[oauth] WL Data API indisponible (${apiError.message}), repli youtubei.js`); } catch {} const { items } = await fetchInnerTubeWatchLaterViaLib(conn, 100); + try { + console.log(`[oauth] WL via innertube user=${req.user?.id} count=${items.length}`); + } catch {} return res.json({ items, count: items.length, writeGranted, via: 'innertube', note: 'Liste lue via InnerTube (l’API YouTube ne l’expose pas pour ce compte).', @@ -718,11 +721,18 @@ r.get('/oauth/google/yt-history', authMiddlewareCookieAware, oauthLimiter, async const conn = await freshOAuthToken(req.user.id, 'google'); const max = Math.min(500, Math.max(1, Number(req.query.max || 200))); const { items, hasMore } = await fetchInnerTubeHistory(conn, max); + try { + console.log(`[oauth] yt-history user=${req.user?.id} count=${items.length} hasMore=${hasMore}`); + } catch {} return res.json({ items, count: items.length, hasMore }); } catch (error) { const out = { error: error?.message || 'ythistory_fetch_failed' }; if (error?.ytReason) out.ytReason = error.ytReason; + if (error?.detail) out.detail = error.detail; if (error?.hint) out.hint = error.hint; + try { + console.warn(`[oauth] yt-history échec user=${req.user?.id} code=${out.error} detail=${String(error?.detail || error?.ytReason || '').slice(0, 300)}`); + } catch {} if (!out.hint && error?.status === 401) { out.hint = 'Session Google expirée : déconnectez puis reconnectez Google.'; } else if (!out.hint && String(error?.ytReason || '').toLowerCase().includes('insufficientpermissions')) {