K8S : error in ERPNEXT migrate

Hello,

We are using ERPNext with Helm Chart. A few weeks ago, we activate the Migration job. Everything was working perfectly. I just came back from holidays, tried to deploy some changes on my API endpoint (nothing fancy) and I end up with a broken environment. The migration job fails on the migration of frappe DocTypes for the following reason :

stream closed EOF for mvdch-staging/migrate-sites-on-deploy-mvd-erpnextdvr84-rvhxt (set-maintenance-mode)

migrate Migrating
migrate
Updating DocTypes for frappe : [ ]
migrate Traceback (most recent call last):
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 204, in load_doctype_module
migrate doctype_python_modules[key] = frappe.get_module(module_name)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 870, in get_module
migrate return importlib.import_module(modulename)
migrate File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
migrate return _bootstrap._gcd_import(name[level:], package, level)
migrate File “”, line 1006, in _gcd_import
migrate File “”, line 983, in _find_and_load
migrate File “”, line 967, in _find_and_load_unlocked
migrate File “”, line 677, in _load_unlocked
migrate File “”, line 728, in exec_module
migrate File “”, line 219, in _call_with_frames_removed
migrate File “/home/frappe/frappe-bench/apps/erpnext/erpnext/buying/doctype/supplier/supplier.py”, line 11, in
migrate from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
migrate File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/party.py”, line 12, in
migrate from frappe.contacts.doctype.address.address import (get_address_display,
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/contacts/doctype/address/address.py”, line 12, in
migrate from jinja2 import TemplateSyntaxError
migrate File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/jinja2/init.py”, line 12, in
migrate from .environment import Environment
migrate File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/jinja2/environment.py”, line 25, in
migrate from .defaults import BLOCK_END_STRING
migrate File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/jinja2/defaults.py”, line 3, in
migrate from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
migrate File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/jinja2/filters.py”, line 13, in
migrate from markupsafe import soft_unicode
migrate ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’ (/home/frappe/frappe-bench/env/lib/python3.7/site-packages/markupsafe/init.py)
migrate
migrate During handling of the above exception, another exception occurred:
migrate
migrate Traceback (most recent call last):
migrate File “/home/frappe/frappe-bench/commands/migrate.py”, line 52, in
migrate main()
migrate File “/home/frappe/frappe-bench/commands/migrate.py”, line 45, in main
migrate migrate_sites()
migrate File “/home/frappe/frappe-bench/commands/migrate.py”, line 36, in migrate_sites
migrate migrate()
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 50, in migrate
migrate frappe.model.sync.sync_all(verbose=verbose)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
migrate sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 56, in sync_for
migrate reset_permissions=reset_permissions, for_sync=True)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 66, in import_file_by_path
migrate ignore_version=ignore_version, reset_permissions=reset_permissions)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 141, in import_doc
migrate doc.insert()
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in insert
migrate self.run_post_save_methods()
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 936, in run_post_save_methods
migrate self.run_method(“on_update”)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 806, in run_method
migrate out = Document.hook(fn)(self, *args, **kwargs)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1085, in composer
migrate return composed(self, method, *args, **kwargs)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1068, in runner
migrate add_to_return_value(self, fn(self, *args, **kwargs))
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 800, in
migrate fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 300, in on_update
migrate self.run_module_method(“on_doctype_update”)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 369, in run_module_method
migrate module = load_doctype_module(self.name, self.module)
migrate File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 206, in load_doctype_module
migrate raise ImportError(‘Module import failed for {0} ({1})’.format(doctype, module_name + ’ Error: ’ + str(e)))
migrate ImportError: Module import failed for Supplier (erpnext.buying.doctype.supplier.supplier Error: cannot import name ‘soft_unicode’ from ‘markupsafe’ (/home/frappe/frappe-bench/env/lib/python3.7/site-packages/markupsafe/init.py))
Stream closed EOF for mvdch-staging/migrate-sites-on-deploy-mvd-erpnextdvr84-rvhxt (populate-assets)
Stream closed EOF for mvdch-staging/migrate-sites-on-deploy-mvd-erpnextdvr84-rvhxt (migrate)

Does any of you have a hint for me? We didn’t change anything, execept code within an app.

We are using ERPNext v12

Thanks in advance.

Benoit

Can you confirm the previous image tag works? Then you can focus on debugging the app.

Error: cannot import name ‘soft_unicode’ from ‘markupsafe’

https://markupsafe.palletsprojects.com/en/2.1.x/changes/#version-2-1-0

Pin your markupsafe version to 2.0.1 instead of using latest.

This means you will need to pin everything to previous versions that were latest during v12 period.

How can I do that, as it’s a dependence from frappe. The only think that I do is install my app in the official frappe docker? For ex: frappe/erpnext-worker:version-12

FROM frappe/erpnext-worker:v12.29.0

RUN /home/frappe/frappe-bench/env/bin/pip install --force-reinstall markupsafe==2.0.1

...

As I might not be the only one, wouldn’t it make sense to pin those dependencies inside of the docker image? From what I understand, those images will not work anymore.

I don’t know if downgrade is a general solution.
use if it works for you. does it solve the problem?

if it needs to be pinned then it needs to be pinned in frappe version 12. not even in docker image.

if it is not pinned in Frappe or in official docker image, just add it part of your image.

Yes it worked. But know the script cannot connect to the db anymore. We get an access denied.

I think that it need to be pinned in Frappe 12 then. Are you also in charge of Frappe or should I open a ticket somewhere else ?

there was a release to solve this https://github.com/frappe/frappe/releases/tag/v12.26.1

Awesome @revant_one. Thank you. Will try it tomo and update you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.