Skip to content

fix(facebook): map page-permission (code 190) errors to a curated message - #1912

Closed
giladresisi wants to merge 1 commit into
stagingfrom
fix/facebook-190-page-permission-mapping
Closed

giladresisi wants to merge 1 commit into
stagingfrom
fix/facebook-190-page-permission-mapping

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Bug fix / UX improvement

Why was this change needed?

A customer with several Facebook Pages had posts failing on some pages only, every time, with this Graph API response:

{"error":{"message":"Any of the pages_read_engagement, pages_manage_metadata, pages_read_user_content, pages_manage_ads, pages_show_list or pages_messaging permission(s) must be granted before impersonating a user's page.","type":"OAuthException","code":190}}

Although it carries code 190, this is a page-permission problem (the connected Facebook user lacks adequate access on that specific Page), not an expired/invalid token: sibling pages under the same account publish fine, and the customer had already reconnected without effect. FacebookProvider.handleErrors only recognizes the token-validation 190 variants (Error validating access token, REVOKED_ACCESS_TOKEN), so this body fell through to the Unknown Error placeholder — the failure email said nothing useful and the customer could not self-serve.

This adds a curated bad-body mapping on the distinctive before impersonating a user's page phrase:

Facebook rejected the post because your account is missing permissions on this Page. Make sure your Facebook account has full content access to the Page, then reconnect the channel.

bad-body (non-retryable) rather than refresh-token, because reconnecting alone does not fix it and flagging the channel as needing re-auth would be misleading. Placed before the existing bare '490' substring check so it takes precedence.

Companion to #1892, which maps the sibling (#200) permission error; together with #1868 (curated calendar tooltips) the user sees the actionable message directly on the failed post.

Reference on this error string: https://docs.contentstudio.io/article/688-facebook-errors (same message, attributed to missing page administration access).

Other information:

Verified against production data: on the affected pages 100% of attempts carried this exact body (dozens of occurrences across three pages, continuing after a fresh reconnect), while the customer's other pages published normally.

Checklist:

  • I have read the CONTRIBUTING guide.
  • I have signed the Contributor License Agreement (CLA).
  • I confirm I have not used AI to submit this PR or generate code for it.
  • I checked that there were no similar issues or PRs already open for this.
  • This PR fixes just ONE issue

🤖 Generated with Claude Code

…sage

Facebook rejects page publishes with OAuthException code 190 and the
message "...permission(s) must be granted before impersonating a user's
page" when the connected user lacks the required page-level permissions.
Unlike the token-validation 190 variants this is not fixed by reconnecting,
so it is mapped as a non-retryable bad-body with an actionable message
instead of falling through to the 'Unknown Error' placeholder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@strix-security

strix-security Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Strix Security Review

No security issues found.

Updated for 329ba84.


Reviewed by Strix
Re-run review · Configure security review settings

@postiz-contribution
postiz-contribution Bot changed the base branch from main to staging August 18, 2026 01:24
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Aug 18, 2026
@postiz-agent

postiz-agent Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@giladresisi

Copy link
Copy Markdown
Collaborator Author

Closing: this mapping will be added to #1719 instead (that PR is being updated to handle the same error case, together with its generic code 190 handling, so the two do not conflict). Not finished yet, will land there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant