chore(tiktok): log fail_reason when a post stays in progress - #1883
Open
giladresisi wants to merge 1 commit into
Open
chore(tiktok): log fail_reason when a post stays in progress#1883giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
Several users reported TikTok posts that Postiz marked as unconfirmed: the publish is accepted and returns a publish id, but every status check comes back in a processing state for the full 30 minute polling window, never PUBLISH_COMPLETE and never FAILED. Their TikTok inboxes show the content never arrived, so these posts were not published after all, and we have nothing to tell the user beyond "we could not confirm it". TikTok's status response carries a fail_reason field next to the status. We only read it on FAILED today, where handleErrors already surfaces it, and discard it everywhere else. If TikTok ever populates it while still reporting progress, that is the explanation we are missing, and a possible stop condition for the polling instead of waiting out the full window. Log it only on the path that returns "still pending", so nothing is logged on either success branch or on FAILED. The line is a no-op while the API behaves as documented, and the polling behaviour is unchanged - this only observes, it does not act on the field.
✅ 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. |
giladresisi
force-pushed
the
fix/tiktok-status-fail-reason
branch
from
August 12, 2026 11:56
9290395 to
ce3c2e6
Compare
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.
What kind of change does this PR introduce?
Logging only, for troubleshooting. No behaviour change.
Why was this change needed?
Multiple users are hitting the same TikTok failure: the post is accepted by TikTok and comes back with a publish id, but every subsequent status check reports the post as still in progress for the entire 30 minute polling window. It never reaches
PUBLISH_COMPLETEand it is never returned asFAILED, so we exhaust the checks and mark the post as unconfirmed, which is all the user sees.These posts do not appear to publish at all. One affected user posts image carousels to their TikTok inbox and reports the content never arrives there; another hits the same thing with direct posts. So the format is common to both, the posting method is not, and in every case TikTok gives us no reason we could show the user.
TikTok's status response includes a
fail_reasonfield alongsidestatus. Today we only benefit from it onFAILED, wherehandleErrorsalready matches thespam_risk*values and surfaces them; on every other status we readstatusand drop the rest. If TikTok ever populatesfail_reasonwhile still reporting the post as in progress, that is exactly the explanation we have been missing, and it would also give us a stop condition for the polling instead of waiting out the full window and giving up.This logs the field only on the path that returns "still pending" - after the two success branches and after
FAILED- so nothing is logged when the API behaves as documented. It is a no-op in the healthy case.Other information:
Deliberately observe-only. The value is logged and nothing acts on it, because failing a post on an undocumented signal could kill publishes that would otherwise have completed. Once we have real values we can decide whether to end the polling early on it.
Trade-offs worth knowing:
maxPendingChecks = 90at 20 second intervals). Noisy per incident, but only in the case we want to see, and these are rare.fail_reasonif it only ever arrives on a status we treat as successful. That is intentional: the post published either way, so it would be logging for nothing.Reference: https://developers.tiktok.com/doc/content-posting-api-reference-get-video-status
Checklist:
Put a "X" in the boxes below to indicate you have followed the checklist;