Skip to content

Added some debugging for posting instagram image carousels. #1394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geoff-maddock
Copy link
Owner

No description provided.

@geoff-maddock geoff-maddock requested a review from Copilot May 13, 2025 18:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces debugging improvements for Instagram carousel posting by refining error messages and adjusting the media type based on the number of IG IDs.

  • Added conditional logic in the Instagram service to select between IMAGE and CAROUSEL media types.
  • Updated error messages and logging in the EventsController to output more detailed debugging information.
  • Temporarily commented out sections related to processing additional photos.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/Services/Integrations/Instagram.php Refactored media type selection for endpoint construction.
app/Http/Controllers/EventsController.php Enhanced error reporting and added debugging output on failures.

Comment on lines +1616 to +1618
flash()->error('Error', 'Photo is not primary');

return back();
Copy link
Preview

Copilot AI May 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The else branch returns early when encountering a non-primary photo. If non-primary photos might be expected, consider processing remaining photos instead of exiting immediately.

Suggested change
flash()->error('Error', 'Photo is not primary');
return back();
Log::info('Skipping non-primary photo.');
continue;

Copilot uses AI. Check for mistakes.

Comment on lines +1627 to +1630
// transform the igContainerIds into a string
$igContainerIdsString = implode(', ', $igContainerIds);
flash()->error('Error', 'There was an error posting carousel to Instagram. Unable to create carousel. Please try again. Ids: '.count($igContainerIds).' Container ids: '.$igContainerIdsString.' caption: '.substr($caption, 0, 5));
Log::info('Error creating carousel '.$e->getMessage());
Copy link
Preview

Copilot AI May 13, 2025

Choose a reason for hiding this comment

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

The flash error message now includes container IDs and a caption substring which may expose sensitive or internal debugging information. Consider logging these details securely and providing a user-friendly error message.

Suggested change
// transform the igContainerIds into a string
$igContainerIdsString = implode(', ', $igContainerIds);
flash()->error('Error', 'There was an error posting carousel to Instagram. Unable to create carousel. Please try again. Ids: '.count($igContainerIds).' Container ids: '.$igContainerIdsString.' caption: '.substr($caption, 0, 5));
Log::info('Error creating carousel '.$e->getMessage());
// Log sensitive details securely
$igContainerIdsString = implode(', ', $igContainerIds);
Log::info('Error creating carousel. Container IDs: '.$igContainerIdsString.', Caption: '.$caption.', Exception: '.$e->getMessage());
flash()->error('Error', 'There was an error posting carousel to Instagram. Unable to create carousel. Please try again.');

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant