fix: use plain fetch instead of this.fetch in analytics methods#1725
Merged
Conversation
this.fetch is the posting wrapper: it routes errors through handleErrors, sleeps and retries on 429/500, and throws Temporal ApplicationFailures (BadBody/RefreshToken) — none of which belong in analytics calls served from the API. Analytics methods that fail now return empty data like the existing plain-fetch analytics implementations do. Affected: Pinterest, Facebook, Instagram, LinkedIn Page, Threads (postAnalytics) and TikTok (analytics + postAnalytics). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Contribution-checker quality warning Heuristics that flagged:
If this is a genuine contribution, please add detail to your PR description and tighten the diff scope before reviewers look at it. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
this.fetch(fromSocialAbstract) is the posting wrapper: it routes response bodies throughhandleErrors(), sleeps 5s and retries on 429/500, and throws TemporalApplicationFailures (BadBody/RefreshToken). None of that belongs in analytics calls served from the backend API — and it forces analytics concerns intohandleErrors, as seen in #1665 (review: "this.fetch should not be connected with pinterest analytics").Changes
Swapped
this.fetch→ plainfetch(the pattern every existinganalytics()implementation already uses) in every analytics method that used it:postAnalyticspostAnalyticspostAnalyticspostAnalytics(2 calls)postAnalyticsanalytics(3 calls) andpostAnalytics(2 calls)On failure these methods now fall into their existing catch/fallback paths and return empty data, same as the plain-fetch analytics methods behave today. Non-analytics uses of
this.fetch(posting, TikTokmissing(), LinkedIn repost plug) are untouched.🤖 Generated with Claude Code