Skip to content

Commit 432b504

Browse files
authored
Merge pull request #181 from scriptaiapp/railway/code-change-eHAafN
Add error logging to YouTube channel-videos endpoint
2 parents 5c8729c + b6091ad commit 432b504

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/api/src/youtube/youtube.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export class YoutubeService {
7272
throw new NotFoundException('YouTube channel not found. Please connect your channel first.');
7373
}
7474

75+
console.error('Supabase channel lookup result:', { channel_id: channel.channel_id, has_provider_token: !!channel.provider_token, has_refresh_token: !!channel.refresh_token, supabase_error: error });
76+
7577
const accessToken = await this.resolveAccessToken(userId, channel);
7678

7779
const searchParams: Record<string, string | number | boolean> = {
@@ -87,7 +89,8 @@ export class YoutubeService {
8789
params: searchParams,
8890
headers: { Authorization: `Bearer ${accessToken}` },
8991
timeout: 15000,
90-
}).catch(() => {
92+
}).catch((error) => {
93+
console.error('YouTube search API error:', error.response?.data || error.message);
9194
throw new InternalServerErrorException('Failed to fetch videos from YouTube');
9295
});
9396

@@ -101,7 +104,10 @@ export class YoutubeService {
101104
params: { part: 'statistics', id: videoIds },
102105
headers: { Authorization: `Bearer ${accessToken}` },
103106
timeout: 15000,
104-
}).catch(() => null);
107+
}).catch((error) => {
108+
console.error('YouTube stats API error:', error.response?.data || error.message);
109+
return null;
110+
});
105111

106112
const statsMap = new Map<string, number>();
107113
if (statsRes?.data?.items) {

0 commit comments

Comments
 (0)