-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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. |
flash()->error('Error', 'Photo is not primary'); | ||
|
||
return back(); |
There was a problem hiding this comment.
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.
flash()->error('Error', 'Photo is not primary'); | |
return back(); | |
Log::info('Skipping non-primary photo.'); | |
continue; |
Copilot uses AI. Check for mistakes.
// 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()); |
There was a problem hiding this comment.
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.
// 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.
No description provided.