Skip to content

Marcus finishes facebook autoposter backend#2005

Open
marcusyi1 wants to merge 19 commits intodevelopmentfrom
Marcus-finishes-facebook-autoposter
Open

Marcus finishes facebook autoposter backend#2005
marcusyi1 wants to merge 19 commits intodevelopmentfrom
Marcus-finishes-facebook-autoposter

Conversation

@marcusyi1
Copy link
Copy Markdown
Contributor

Main frontend PR: OneCommunityGlobal/HighestGoodNetworkApp#4714

Main changes explained:

New Files:

  • src/controllers/facebookAuthController.js
  • src/models/facebookConnectionModel.js
  • src/routes/facebookAuthRoutes.js
    Updated Files:
  • src/controllers/facebookSocialMediaController.js
  • src/models/scheduledPostSchema.js
  • src/cronjobs/socialPostScheduler.js
  • src/routes/fbSocialmediaRouter.js
    Environment Variables Added:
  • FACEBOOK_APP_ID=your_app_id
  • FACEBOOK_APP_SECRET=your_app_secret
  • FACEBOOK_PAGE_ID=fallback_page_id (optional, for legacy support)
  • FACEBOOK_PAGE_ACCESS_TOKEN=fallback_token (optional, for legacy support)

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Jan 15, 2026
@maithili20
Copy link
Copy Markdown
Contributor

Hi @marcusyi1
Left my comments on FE PR OneCommunityGlobal/HighestGoodNetworkApp#4714 (comment)

} catch (error) {
const fbError = error.response?.data?.error;

const connection = await FacebookConnection.getActiveConnection();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called again, but it was already fetched at the top of the function. If the first call succeeded but the axios call failed, the connection is already in scope and no need to fetch it again. Also if this second call itself throws, the error will be swallowed entirely.


const connection = await FacebookConnection.getActiveConnection();
if (connection) {
connection.lastError = fbError?.message || error.message;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the reason this is a POST rather than GET because it updates lastVerifiedAt and lastError after verifying? Just want to understand the intent here

Comment thread src/routes/facebookRouter.js Outdated
router.route('/social/facebook/auth/callback').post(handleAuthCallback);
router.route('/social/facebook/auth/connect').post(connectPage);
router.route('/social/facebook/auth/disconnect').post(disconnectPage);
router.route('/social/facebook/auth/verify').post(verifyConnection);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed if agreed to change it as GET

@SharadhaKasiviswanathan
Copy link
Copy Markdown

SharadhaKasiviswanathan commented Apr 7, 2026

Tested /api/social/facebook/auth/status which responded with {"connected":false,"message":"No Facebook Page connected"}, so the frontend crash is happening before the Facebook backend flow is reached, so unable to complete the actual Facebook OAuth/posting step after that. Also posted comments and screenshots on the frontend for PR #4714 OneCommunityGlobal/HighestGoodNetworkApp#4714 (comment)

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
3.7% Duplication on New Code (required ≤ 3%)
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants