fix: detect publish_video permission error + show required permissions in Pages UI

- Detect Facebook error subcode 1363042 (missing publish_video permission)
  and throw a clear actionable message explaining how to fix it
- Add permission notice banner in Pages admin showing the 3 required
  Facebook permissions: pages_manage_posts, pages_read_engagement, publish_video

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Sonnet 4.6 committed 2026-03-25 20:51:47 +01:00
1 parent 8f13d3021e
commit 2a93c2aea7
2 files changed
+26 -1

No files matched your search

+10 -1
View File
@@ -592,7 +592,16 @@ export class FacebookService {
console.log('📤 Facebook START response:', startRaw);
const startData = JSON.parse(startRaw) as any;
if (!startRes.ok || startData.error) {
throw new Error(`Facebook upload START error: ${startData.error?.message ?? startRaw} (code: ${startData.error?.code}, subcode: ${startData.error?.error_subcode})`);
const subcode = startData.error?.error_subcode;
if (subcode === 1363042) {
throw new Error(
`Le token Facebook de la page "${page.pageName}" n'a pas la permission "publish_video". ` +
`Régénérez le token dans Graph API Explorer en ajoutant les permissions : ` +
`pages_manage_posts, pages_read_engagement, publish_video. ` +
`(code: ${startData.error?.code}, subcode: ${subcode})`
);
}
throw new Error(`Facebook upload START error: ${startData.error?.message ?? startRaw} (code: ${startData.error?.code}, subcode: ${subcode})`);
}
const { upload_session_id, video_id } = startData;
let startOffset: number = parseInt(startData.start_offset ?? '0', 10);