Comments (3)
Hi @wrong1man are there any errors returned from the API call? what are the errors?
according to the stack trace, it appears that the request call failed on getting the response. was it taking too long time? have you tried to reproduce by sending raw requests without using sdk?
from facebook-python-business-sdk.
hey @stcheng
Thank you for your response. Unfortunately, there is no specific error message returned from the API call. The issue that I am facing is that roughly 31% of around 220 events reported by my backend in the last three days have failed. The error traceback I shared earlier is what I get for these failed
I can manually re-trigger them and they usually go through.
To handle this, I've implemented a try-except block to catch all exceptions and log either the API response or the error traceback to a database. Here's the code snippet for your reference:
resp=None
try:
resp = self.send_meta_event(client_ip, client_user_agent, fbc, fbp)
received=resp["events_received"] == True # this allways fails - Logging all events
except:
trace = traceback.format_exc() if not resp else resp
Generic_error_log.objects.create(
function_code="Purchase - send_meta_event",
traceback = str(trace),
related_element_id=f"Dinner_booking - {self.id}"
)
pass
I've recently updated the code to include more information in case of exceptions (but i don't have one of these yet):
except Exception as e:
#...
trace=traceback.format_exc() + "\n"+str(e) if not resp else resp
#...
I am currently logging all events to understand the rate of success and failure. Any suggestions on how to further investigate this issue would be highly appreciated.
Would it be beneficial to log the time it takes to run the meta_api_send_event function? I would expect a timeout error to present itself in the traceback, wouldn't it?
I appreciate your suggestion of attempting to reproduce the issue manually by sending raw requests without using the SDK. However, given the sporadic occurrence of the error, it's been challenging to reproduce it consistently even with the SDK. Furthermore, testing outside of the SDK might not necessarily aid in identifying or resolving the root cause of the issue.
My primary goal is to understand why this error is happening and why the process abruptly aborts. If it's a matter of a timeout, for instance, I could potentially adjust the timeout duration or defer the event reporting to a later time.
In this context, any insights or suggestions that could help me further diagnose this problem would be immensely valuable. Thanks again for your help and cooperation.
from facebook-python-business-sdk.
Futher investigation revealed it was indeed a timeout.
I placed the event reporting on a task queue (celery) sometimes requests take over 3 minutes to complete.
I can re-launch the event report, but its a bit worrying to me that it takes so long to report an event, any ideas on what s happening?
from facebook-python-business-sdk.
Related Issues (20)
- Fb.me
- Fb.me/hacked
- 502 bad gateway error when trying to create campaigns with adsets and ads.
- fb.marketing/bruterforce sdk
- FacebookBadObjectError("Bad data to set object data") is raised. HOT 7
- 'TypeError: string indices must be integers' when getting AdCreatives HOT 3
- AdCreatives Endpoint is incorrect HOT 1
- Hello
- Fb.com bruterforce attack
- fbMarketplace.com bruterforce attack
- Fb.me bruterforce attack
- [New Pages Experience] HOT 5
- Which versions of this Business SDK package correspond to the Marketing API versions? HOT 1
- Always got "The value must be a valid insights metric" error HOT 2
- Stub files
- typechecker.py does not handle <list<map<string, string>>> correctly. HOT 1
- facebook_business.adobjects.business.Business get_ad_network_analytics() ERROR HOT 3
- Meta API does not respond to requests, hosted on Azure HOT 3
- Error : Cannot include in summary param error message HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-python-business-sdk.