-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
Describe the Issue
Since the label does not exists, and we are trying to fetch the label information resulting in the 404 error.
Possible solution
When we encounter 404 for any label, we can skip the pulling altogether for the label, and remove the label from the gmail thread label information, since it will be created next time the email is pulled and label exists.
Traceback
Traceback with variables (most recent call last):
File "apps/frappe/frappe/utils/background_jobs.py", line 222, in execute_job
retval = method(**kwargs)
site = 'erp.rtcamp.com'
method = <function sync at 0x7e084bd29580>
event = None
job_name = 'gmail_thread_sync_zeel.prajapati@rtcamp.com'
kwargs = {'user': 'zeel.prajapati@rtcamp.com'}
user = 'Administrator'
is_async = True
retry = 0
retval = None
method_name = 'frappe_gmail_thread.frappe_gmail_thread.doctype.gmail_thread.gmail_thread.sync'
before_job_task = 'frappe.monitor.start'
File "apps/frappe_gmail_thread/frappe_gmail_thread/frappe_gmail_thread/doctype/gmail_thread/gmail_thread.py", line 255, in sync
.execute()
user = 'zeel.prajapati@rtcamp.com'
gmail_account = <GmailAccount: zeel.prajapati@rtcamp.com>
gmail = <googleapiclient.discovery.Resource object at 0x7e084b4a68d0>
label_ids = ['Label_3705288279086124237']
last_history_id = 240456
label_id = 'Label_3705288279086124237'
File "env/lib/python3.11/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
args = (<googleapiclient.http.HttpRequest object at 0x7e084b37b090>,)
kwargs = {}
max_positional_args = 1
wrapped = <function HttpRequest.execute at 0x7e084ce10720>
File "env/lib/python3.11/site-packages/googleapiclient/http.py", line 935, in execute
raise HttpError(resp, content, uri=self.uri)
self = <googleapiclient.http.HttpRequest object at 0x7e084b37b090>
http = <google_auth_httplib2.AuthorizedHttp object at 0x7e084b4a6790>
num_retries = 0
resp = {'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Tue, 20 May 2025 11:00:19 GMT', 'server': 'ESF', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'transfer-encoding': 'chunked', 'status': '404', 'content-length': '264', '-content-encoding': 'gzip'}
content = b'{\n "error": {\n "code": 404,\n "message": "Requested entity was not found.",\n "errors": [\n {\n "message": "Requested entity was not found.",\n "domain": "global",\n "reason": "notFound"\n }\n ],\n "status": "NOT_FOUND"\n }\n}\n'
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://gmail.googleapis.com/gmail/v1/users/me/history?startHistoryId=240456&historyTypes=messageAdded&historyTypes=labelAdded&labelId=Label_3705288279086124237&alt=json returned "Requested entity was not found.". Details: "[{'message': 'Requested entity was not found.', 'domain': 'global', 'reason': 'notFound'}]">
Reactions are currently unavailable