Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(bluesky): only mark the channel disconnected on a 4xx login failure

Gilad Resisi0b26c98e64dc
diff --git a/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts b/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts
index 90cb502f5..4efd91c26 100644
--- a/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts
@@ -371,8 +371,22 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
identifier: body.identifier,
password: body.password,
});
- } catch (err) {
- throw new RefreshToken('bluesky', JSON.stringify(err), {} as BodyInit);
+ } catch (err: any) {
+ // Only a definite 4xx (bad password, account taken down) means the
+ // credentials are broken. A 5xx or network error is Bluesky being
+ // unavailable: let it propagate as a transient failure instead of
+ // marking the channel as disconnected.
+ const status = err?.status;
+ if (
+ typeof status === 'number' &&
+ status >= 400 &&
+ status < 500 &&
+ status !== 429
+ ) {
+ throw new RefreshToken('bluesky', JSON.stringify(err), {} as BodyInit);
+ }
+
+ throw err;
}
return agent;