facebook-python-business-sdk
facebook-python-business-sdk copied to clipboard
Error : Cannot include in summary param error message
Facebook Python Business SDK Issue
Hi, Many of our customers facing the below intermittent issue : We are using facebook-ads with version v17 and facebook_business version 17.0.2
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v17.0/28371227371247237/insights
Params: {'after': 'MTM4MjQZD'}
Status: 400
Response:
{
"error": {
"message": "(#100) Cannot include inline_post_engagement, clicks, video_p100_watched_actions, campaign_name, unique_inline_link_clicks, adset_name, video_p25_watched_actions, unique_clicks, cost_per_unique_click, account_name, ad_name, account_id, quality_ranking, ad_id, unique_ctr, canvas_avg_view_time, campaign_id, inline_link_clicks, unique_inline_link_click_ctr, adset_id, engagement_rate_ranking, cost_per_inline_link_click, unique_link_clicks_ctr, cpc, video_30_sec_watched_actions, reach, video_play_curve_actions, cpp, ctr, cost_per_unique_inline_link_click, spend, canvas_avg_view_percent, video_p75_watched_actions, inline_link_click_ctr, frequency, impressions, cpm, objective, video_p50_watched_actions, website_ctr, cost_per_inline_post_engagement, conversion_rate_ranking in summary param because they weren't there while creating the report run. All available values are: ",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AFRyIHeWbe5NN7kMsni8jOB"
}
}
And, alternatively, I get below error as well :
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v17.0/9233108812349109180/insights
Params: {'after': 'MjU2NADkZD'}
Status: 500
Response:
{
"error": {
"message": "An unexpected error has occurred. Please retry your request later.",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "AIhHc2DM_BCkpaF6oS2fQ-Z"
}
}
Can you guide us why we are getting these errors?
Hi rdeshmukh15 👋
Can you share your SDK implementation details ( code snipet / full graph api call ) ?
@Just1B : This is the code, we are using https://github.com/singer-io/tap-facebook
Hi @rdeshmukh15 the two kinds of errors are different. for the second one, the error message indicates that it might be an internal error, I would suggest you to create a bug report to provide more information. For the first one, the error message already indicates the issue. When creating the report run, you'll need to include the params in the first place.
Initially, we didn't encounter any errors in the previous versions like v16.0. However, after upgrading to v17.0, we started experiencing the issue. In an attempt to resolve it, we upgraded further to API version v19.0, but unfortunately, the problem persists.
Could you please verify if there have been any significant changes or updates between v16.0 and the latest API version? We suspect there might be a breaking change causing this issue.
Just to clarify, the parameters included in the job execution are:
{'level': 'ad', 'action_breakdowns': ['action_type', 'action_target_id', 'action_destination'], 'breakdowns': ['region'], 'limit': 100, 'fields': ['inline_post_engagement', 'video_p25_watched_actions', 'account_name', 'cpc', 'cost_per_unique_inline_link_click', 'social_spend', 'spend', 'inline_link_click_ctr', 'canvas_avg_view_percent', 'unique_link_clicks_ctr', 'cost_per_unique_click', 'engagement_rate_ranking', 'adset_id', 'cost_per_inline_post_engagement', 'objective', 'ad_id', 'date_stop', 'cost_per_unique_action_type', 'conversion_rate_ranking', 'inline_link_clicks', 'frequency', 'date_start', 'adset_name', 'cpp', 'video_30_sec_watched_actions', 'cost_per_action_type', 'impressions', 'unique_clicks', 'video_p100_watched_actions', 'cpm', 'unique_ctr', 'clicks', 'reach', 'ad_name', 'video_p50_watched_actions', 'campaign_name', 'campaign_id', 'ctr', 'unique_inline_link_clicks', 'website_ctr', 'video_p75_watched_actions', 'unique_inline_link_click_ctr', 'account_id', 'quality_ranking', 'cost_per_inline_link_click', 'video_play_curve_actions', 'canvas_avg_view_time'], 'time_increment': 1, 'action_attribution_windows': ['1d_click', '7d_click', '28d_click', '1d_view', '7d_view', '28d_view'], 'time_ranges': [{'since': '2024-01-25', 'until': '2024-01-25'}]}
These parameters are included at the start of the report generation process, and no additional parameters are added afterwards. Can you please prioritize looking into this? Because of the error, our customers fail to extract the record.
Our codebase for reference - https://github.com/singer-io/tap-facebook/blob/master/tap_facebook/init.py#L666-#L728
Here are the logs containing the stack trace to assist you in resolving the issue.
2024-03-13 07:57:07,813Z tap - INFO Starting adsinsights job with params {'level': 'ad', 'action_breakdowns': ['action_type', 'action_target_id', 'action_destination'], 'breakdowns': ['region'], 'limit': 100, 'fields': ['spend', 'cost_per_action_type', 'objective', 'reach', 'video_p25_watched_actions', 'cost_per_inline_post_engagement', 'frequency', 'canvas_avg_view_percent', 'account_name', 'cost_per_unique_click', 'unique_ctr', 'engagement_rate_ranking', 'inline_link_clicks', 'video_p50_watched_actions', 'video_play_curve_actions', 'ad_id', 'adset_name', 'canvas_avg_view_time', 'inline_link_click_ctr', 'quality_ranking', 'conversion_rate_ranking', 'unique_inline_link_click_ctr', 'video_30_sec_watched_actions', 'impressions', 'ctr', 'video_p100_watched_actions', 'account_id', 'cpm', 'ad_name', 'video_p75_watched_actions', 'unique_inline_link_clicks', 'campaign_id', 'social_spend', 'cost_per_unique_action_type', 'date_stop', 'website_ctr', 'unique_link_clicks_ctr', 'date_start', 'unique_clicks', 'campaign_name', 'inline_post_engagement', 'cost_per_unique_inline_link_click', 'cost_per_inline_link_click', 'cpp', 'cpc', 'clicks', 'adset_id'], 'time_increment': 1, 'action_attribution_windows': ['1d_click', '7d_click', '28d_click', '1d_view', '7d_view', '28d_view'], 'time_ranges': [{'since': '2024-01-21', 'until': '2024-01-21'}]}
2024-03-13 07:57:08,597Z tap - INFO Job Not Started, 0% done
2024-03-13 07:57:08,597Z tap - INFO sleeping for 10 seconds until job is done
2024-03-13 07:57:18,656Z tap - INFO Job Running, 0% done
2024-03-13 07:57:18,656Z tap - INFO sleeping for 20 seconds until job is done
2024-03-13 07:57:38,718Z tap - INFO Job Running, 55% done
2024-03-13 07:57:38,718Z tap - INFO sleeping for 40 seconds until job is done
2024-03-13 07:58:18,784Z tap - INFO Job Completed, 100% done
2024-03-13 07:58:18,785Z tap - INFO "insights" job took 71.0s, ended with status "succeeded"
2024-03-13 07:58:19,075Z tap - INFO replicated 1 records from "ads_insights_region" endpoint
2024-03-13 07:59:02,817Z target - INFO Serializing batch with 4460 messages for table ads_insights_region
2024-03-13 08:02:26,444Z target - INFO replicated 4159 records from "ads_insights_region" endpoint
2024-03-13 08:03:19,906Z tap - INFO replicated 3961 records from "ads_insights_region" endpoint
2024-03-13 08:03:32,494Z tap - INFO replicated 838 records from "ads_insights_region" endpoint
2024-03-13 08:03:32,495Z tap - ERROR SingerSyncError
2024-03-13 08:03:32,495Z tap - GET: 400 Message: (#100) Cannot include spend, objective, reach, video_p25_watched_actions, cost_per_inline_post_engagement, frequency, canvas_avg_view_percent, account_name, cost_per_unique_click, unique_ctr, engagement_rate_ranking, inline_link_clicks, video_p50_watched_actions, video_play_curve_actions, ad_id, adset_name, canvas_avg_view_time, inline_link_click_ctr, quality_ranking, conversion_rate_ranking, unique_inline_link_click_ctr, video_30_sec_watched_actions, impressions, ctr, video_p100_watched_actions, account_id, cpm, ad_name, video_p75_watched_actions, unique_inline_link_clicks, campaign_id, website_ctr, unique_link_clicks_ctr, unique_clicks, campaign_name, inline_post_engagement, cost_per_unique_inline_link_click, cost_per_inline_link_click, cpp, cpc, clicks, adset_id in summary param because they weren't there while creating the report run. All available values are:
2024-03-13 08:03:32,495Z tap - Traceback (most recent call last):
2024-03-13 08:03:32,495Z tap - File "/code/orchestrator/tap-env/lib/python3.11/site-packages/tap_facebook/__init__.py", line 918, in main_impl
2024-03-13 08:03:32,495Z tap - do_sync(account, catalog, args.state)
2024-03-13 08:03:32,496Z tap - File "/code/orchestrator/tap-env/lib/python3.11/site-packages/tap_facebook/__init__.py", line 807, in do_sync
2024-03-13 08:03:32,496Z tap - for message in stream:
2024-03-13 08:03:32,496Z tap - File "/code/orchestrator/tap-env/lib/python3.11/site-packages/tap_facebook/__init__.py", line 713, in __iter__
2024-03-13 08:03:32,496Z tap - for obj in job.get_result():
2024-03-13 08:03:32,496Z tap - File "/code/orchestrator/tap-env/lib/python3.11/site-packages/facebook_business/api.py", line 789, in __next__
2024-03-13 08:03:32,496Z tap - if not self._queue and not self.load_next_page():
2024-03-13 08:03:32,496Z tap - ^^^^^^^^^^^^^^^^^^^^^
2024-03-13 08:03:32,496Z tap - File "/code/orchestrator/tap-env/lib/python3.11/site-packages/facebook_business/api.py", line 841, in load_next_page
2024-03-13 08:03:32,496Z tap - response_obj = self._api.call(
2024-03-13 08:03:32,496Z tap - ^^^^^^^^^^^^^^^
2024-03-13 08:03:32,496Z tap - File "/code/orchestrator/tap-env/lib/python3.11/site-packages/facebook_business/api.py", line 350, in call
2024-03-13 08:03:32,496Z tap - raise fb_response.error()
2024-03-13 08:03:32,496Z tap - facebook_business.exceptions.FacebookRequestError:
2024-03-13 08:03:32,496Z tap -
2024-03-13 08:03:32,496Z tap - Message: Call was not successful
2024-03-13 08:03:32,496Z tap - Method: GET
2024-03-13 08:03:32,496Z tap - Path: https://graph.facebook.com/v19.0/<id>/insights
2024-03-13 08:03:32,497Z tap - Params: {'after': 'MjIwMjQZD'}
2024-03-13 08:03:32,497Z tap -
2024-03-13 08:03:32,497Z tap - Status: 400
2024-03-13 08:03:32,497Z tap - Response:
2024-03-13 08:03:32,497Z tap - {
2024-03-13 08:03:32,497Z tap - "error": {
2024-03-13 08:03:32,497Z tap - "message": "(#100) Cannot include spend, objective, reach, video_p25_watched_actions, cost_per_inline_post_engagement, frequency, canvas_avg_view_percent, account_name, cost_per_unique_click, unique_ctr, engagement_rate_ranking, inline_link_clicks, video_p50_watched_actions, video_play_curve_actions, ad_id, adset_name, canvas_avg_view_time, inline_link_click_ctr, quality_ranking, conversion_rate_ranking, unique_inline_link_click_ctr, video_30_sec_watched_actions, impressions, ctr, video_p100_watched_actions, account_id, cpm, ad_name, video_p75_watched_actions, unique_inline_link_clicks, campaign_id, website_ctr, unique_link_clicks_ctr, unique_clicks, campaign_name, inline_post_engagement, cost_per_unique_inline_link_click, cost_per_inline_link_click, cpp, cpc, clicks, adset_id in summary param because they weren't there while creating the report run. All available values are: ",
2024-03-13 08:03:32,497Z tap - "type": "OAuthException",
2024-03-13 08:03:32,497Z tap - "code": 100,
2024-03-13 08:03:32,497Z tap - "fbtrace_id": "AGaMoLnWoEzJDtzjLyPUelZ"
2024-03-13 08:03:32,497Z tap - }
2024-03-13 08:03:32,497Z tap - }
The error originates from the SDK, specifically from the api.py file, in the definition load_next_page. https://github.com/facebook/facebook-python-business-sdk/blob/main/facebook_business/api.py#L813
Please note that I intentionally removed the ID from the Graph API endpoint for security reasons.
Could someone please prioritize investigating this issue promptly? We are experiencing failures across multiple connections due to the error mentioned above.