π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: fix refresh token
Nevo David204739f0496f
diff --git a/apps/orchestrator/src/workflows/post.workflow.ts b/apps/orchestrator/src/workflows/post.workflow.tsindex 37ca18647..135cda740 100644--- a/apps/orchestrator/src/workflows/post.workflow.ts+++ b/apps/orchestrator/src/workflows/post.workflow.ts@@ -194,7 +194,7 @@ export async function postWorkflow({`Error posting on ${post.integration?.providerIdentifier} for ${post?.integration?.name}`,`An error occurred while posting on ${post.integration?.providerIdentifier- }${err?.message ? `: ${err?.message}` : ``}`,+ }${err?.cause?.message ? `: ${err?.cause?.message}` : ``}`,true,false,'fail'diff --git a/libraries/nestjs-libraries/src/integrations/social.abstract.ts b/libraries/nestjs-libraries/src/integrations/social.abstract.tsindex f225dae35..a3dd40e78 100644--- a/libraries/nestjs-libraries/src/integrations/social.abstract.ts+++ b/libraries/nestjs-libraries/src/integrations/social.abstract.ts@@ -63,10 +63,18 @@ export abstract class SocialAbstract {value = await func();} catch (err) {const handle = this.handleErrors(JSON.stringify(err));- value = { err: true, ...(handle || {}) };+ value = { err: true, value: 'Unknown Error', ...(handle || {}) };}if (value && value?.err && value?.value) {+ if (value.type === 'refresh-token') {+ throw new RefreshToken(+ '',+ JSON.stringify({}),+ {} as any,+ value.value || ''+ );+ }throw new BadBody('', JSON.stringify({}), {} as any, value.value || '');}diff --git a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.tsindex d35762f56..96b8858e0 100644--- a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts@@ -117,6 +117,14 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider {};}+ if (body.includes('Unauthorized')) {+ return {+ type: 'refresh-token',+ value:+ 'Token expired or invalid, please reconnect your YouTube account.',+ };+ }+return undefined;}