Hi! I have a multi site environment using helm chart for ERPNext, and suddenly after 5 months working, scheduled jobs of type repost_item_valuation.repost_entries are failing.
Yesterday I created a new site and after some minutes, the problem happens.
Scheduled jobs of other types are working. I already checked and the scheduler is enabled. I’m using the ERPNext version “v14.27.0”.
The error in the details of a repost_item_valuation.repost_entries is:
`Traceback (most recent call last):
File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 200, in repost
repost_sl_entries(doc)
File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 230, in repost_sl_entries
repost_future_sle(
File "apps/erpnext/erpnext/stock/stock_ledger.py", line 227, in repost_future_sle
obj = update_entries_after(
^^^^^^^^^^^^^^^^^^^^^
File "apps/erpnext/erpnext/stock/stock_ledger.py", line 385, in init
self.initialize_previous_data(self.args)
File "apps/erpnext/erpnext/stock/stock_ledger.py", line 416, in initialize_previous_data
previous_sle = get_previous_sle_of_current_voucher(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/erpnext/erpnext/stock/stock_ledger.py", line 1138, in get_previous_sle_of_current_voucher
sle = frappe.db.sql(
^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/database.py", line 244, in sql
self._cursor.execute(query, values)
File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 151, in execute
query = self.mogrify(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 129, in mogrify
query = query % self._escape_args(args, conn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 104, in _escape_args
return {key: conn.literal(val) for (key, val) in args.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 104, in
return {key: conn.literal(val) for (key, val) in args.items()}
^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 530, in literal
return self.escape(obj, self.encoders)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 523, in escape
return converters.escape_item(obj, self.charset, mapping=mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/converters.py", line 23, in escape_item
val = encoder(val, charset, mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/converters.py", line 30, in escape_dict
raise TypeError("dict can not be used as parameter")
TypeError: dict can not be used as parameter
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apps/frappe/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py", line 117, in execute
frappe.get_attr(self.method)()
File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 344, in repost_entries
repost(doc)
File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 221, in repost
notify_error_to_stock_managers(doc, message)
File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 317, in notify_error_to_stock_managers
frappe.sendmail(recipients=recipients, subject=subject, message=message)
File "apps/frappe/frappe/init.py", line 735, in sendmail
builder.process(send_now=now)
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 685, in process
queue_data = self.as_dict(include_recipients=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 726, in as_dict
email_account = self.get_outgoing_email_account()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 594, in get_outgoing_email_account
self._email_account = EmailAccount.find_outgoing(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/email/doctype/email_account/email_account.py", line 43, in wrapper_cache_email_account
matched_accounts = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/email/doctype/email_account/email_account.py", line 323, in find_outgoing
frappe.throw(
File "apps/frappe/frappe/init.py", line 548, in throw
msgprint(
File "apps/frappe/frappe/init.py", line 509, in msgprint
_raise_exception()
File "apps/frappe/frappe/init.py", line 455, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.OutgoingEmailError: Please setup default Email Account from Setup > Email > Email Account`
Hi! I have a multi site environment using helm chart for ERPNext, and suddenly after 5 months working, scheduled jobs of type repost_item_valuation.repost_entries are failing. Yesterday I created a new site and after some minutes, the problem happens.
Scheduled jobs of other types are working. I already checked and the scheduler is enabled. I’m using the ERPNext version “v14.27.0”.
The error in the details of a repost_item_valuation.repost_entries is: `Traceback (most recent call last): File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 200, in repost repost_sl_entries(doc) File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 230, in repost_sl_entries repost_future_sle( File "apps/erpnext/erpnext/stock/stock_ledger.py", line 227, in repost_future_sle obj = update_entries_after( ^^^^^^^^^^^^^^^^^^^^^ File "apps/erpnext/erpnext/stock/stock_ledger.py", line 385, in init self.initialize_previous_data(self.args) File "apps/erpnext/erpnext/stock/stock_ledger.py", line 416, in initialize_previous_data previous_sle = get_previous_sle_of_current_voucher(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/erpnext/erpnext/stock/stock_ledger.py", line 1138, in get_previous_sle_of_current_voucher sle = frappe.db.sql( ^^^^^^^^^^^^^^ File "apps/frappe/frappe/database/database.py", line 244, in sql self._cursor.execute(query, values) File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 151, in execute query = self.mogrify(query, args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 129, in mogrify query = query % self._escape_args(args, conn) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 104, in _escape_args return {key: conn.literal(val) for (key, val) in args.items()} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 104, in
return {key: conn.literal(val) for (key, val) in args.items()}
^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 530, in literal
return self.escape(obj, self.encoders)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 523, in escape
return converters.escape_item(obj, self.charset, mapping=mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/converters.py", line 23, in escape_item
val = encoder(val, charset, mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pymysql/converters.py", line 30, in escape_dict
raise TypeError("dict can not be used as parameter")
TypeError: dict can not be used as parameter
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "apps/frappe/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py", line 117, in execute frappe.get_attr(self.method)() File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 344, in repost_entries repost(doc) File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 221, in repost notify_error_to_stock_managers(doc, message) File "apps/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py", line 317, in notify_error_to_stock_managers frappe.sendmail(recipients=recipients, subject=subject, message=message) File "apps/frappe/frappe/init.py", line 735, in sendmail builder.process(send_now=now) File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 685, in process queue_data = self.as_dict(include_recipients=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 726, in as_dict email_account = self.get_outgoing_email_account() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 594, in get_outgoing_email_account self._email_account = EmailAccount.find_outgoing( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/email/doctype/email_account/email_account.py", line 43, in wrapper_cache_email_account matched_accounts = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/email/doctype/email_account/email_account.py", line 323, in find_outgoing frappe.throw( File "apps/frappe/frappe/init.py", line 548, in throw msgprint( File "apps/frappe/frappe/init.py", line 509, in msgprint _raise_exception() File "apps/frappe/frappe/init.py", line 455, in _raise_exception raise raise_exception(msg) frappe.exceptions.OutgoingEmailError: Please setup default Email Account from Setup > Email > Email Account`
Analyzing our redis queue, I found something interesting:
redis-cli HGETALL rq:job:my_site_01::scheduled_job::erpnext.stock.doctype.repost_item_valuation.repost_item_valuation.repost_entries 1) "failure_ttl" 2) "604800" 3) "result_ttl" 4) "600" 5) "data" 6) "x\x9c}\x8f\xbdN\x031\x10\x84AJB\x1a\xde\xe3(\xf0;P#E\xbc\x81\xe5\xd8\x9b;s\xb1\xd7\xda]\xe7\xa7\x88DI\xe1ry_\xee\x02B\xa2\x80\xed\xe6\xd3hv\xe6m\xf9\xe1no\xae\xd7\xb5nG\xae\x140U\xe2\x9e\xcd\xd6\xf9\xb1'\xac9\xd8W\xdc\xb2\x81\x13\xf8*0\x0b\xdd<\\\xb4k\x0b\x8e\x02\xda\xbaB\x18\xaa\x97\xc7\x00\x1c\xfbl\x80\x8a\x99\x91\xd9%6\x9e\xb0\x1c#\x83\xf1\x98\xb4-*\x03i\xbb\x7f\n)\xe6\xc8BNp\xd2\xab\x042
\xd0\xf6\xfc\xdd\xc0#\x81\t\xe8\xe5<\t\xf6\x03\x84\xba\x87k\x0f\xfb\x17\xa2\x9a\xed/\xacm\t\a\xc8\xa2\x9b\xb6\x9e]\xd9%\xd0\xe1\xae\xad#[\xc7\xe7\xec\xf5\xbd\xad\xc6\xa3\xa3\x9e\xf5\xa2_\x9e9I\xdb\xcb\xb4 \xc3I\x0c\x0b\xfa\xf1\xa7\aAA\x16;mN\xf6\xe0\xf6\xd5I\xc4\xfc?\x9d\xdeS\x04V\xae\xa2\xe6\x13\x11\xda\x8f\x8b" 7) "enqueued_at" 8) "2024-06-26T13:34:34.647989Z" 9) "status" 10) "finished" 11) "worker_name" 12) "e843fe06272a4a7da22ae4f44e06e3ff" 13) "failure_callback_name" 14) "frappe.utils.background_jobs.truncate_failed_registry" 15) "started_at" 16) "2024-06-26T13:34:34.660532Z" 17) "last_heartbeat" 18) "2024-06-26T13:34:35.882289Z" 19) "created_at" 20) "2024-06-26T13:34:34.647826Z" 21) "ended_at" 22) "2024-06-26T13:34:35.882282Z" 23) "failure_callback_timeout" 24) "60" 25) "origin" 26) "home-frappe-frappe-bench:long" 27) "description" 28) "frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name='frappe.core.doctype.scheduled_job_type.scheduled_job_type.run_scheduled_jo..., kwargs={'job_type': 'erpnext.stock.doctype.repost_item_valuation.repost_item_valua..., method='frappe.core.doctype.scheduled_job_type.scheduled_job_type.run_scheduled_jo..., site='my_site_1', user='Administrator')" 29) "timeout" 30) "1500" 31) "success_callback_name"`Anyone has any idea how to solve that? Thank you in advance!