nar-prod.frappe15.africlouds.dev
Open in
urlscan Pro
195.15.201.250
Public Scan
URL:
https://nar-prod.frappe15.africlouds.dev/
Submission: On October 26 via api from US — Scanned from CH
Submission: On October 26 via api from US — Scanned from CH
Form analysis
1 forms found in the DOM<form>
<p>PIN: <input type="text" name="pin" size="14">
<input type="submit" name="btn" value="Confirm Pin">
</p>
</form>
Text Content
OPERATIONALERROR pymysql.err.OperationalError: (1045, "Access denied for user '_5138a6940bc28cb7'@'10.1.202.79' (using password: YES)") TRACEBACK (MOST RECENT CALL LAST) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/UTILS/CACHING.PY", LINE 55, IN WRAPPER args_key = __generate_request_cache_key(args, kwargs) except Exception: return func(*args, **kwargs) try: return frappe.local.request_cache[func][args_key] except KeyError: return_val = func(*args, **kwargs) frappe.local.request_cache[func][args_key] = return_val return return_val * During handling of the above exception, another exception occurred: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/APP.PY", LINE 95, IN APPLICATION response = None try: rollback = True init_request(request) validate_auth() if request.method == "OPTIONS": response = Response() * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/APP.PY", LINE 194, IN INIT_REQUEST if request.method != "OPTIONS": frappe.local.http_request = HTTPRequest() for before_request_task in frappe.get_hooks("before_request"): frappe.call(before_request_task) def setup_read_only_mode(): """During maintenance_mode reads to DB can still be performed to reduce downtime. This function sets up read only mode * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/__INIT__.PY", LINE 1678, IN CALL def call(fn: str | Callable, *args, **kwargs): """Call a function and match arguments.""" if isinstance(fn, str): fn = get_attr(fn) newargs = get_newargs(fn, kwargs) return fn(*args, **newargs) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/__INIT__.PY", LINE 1666, IN GET_ATTR """Get python method object from its name.""" app_name = method_string.split(".", 1)[0] if ( not local.flags.in_uninstall and not local.flags.in_install and app_name not in get_installed_apps() ): throw(_("App {0} is not installed").format(app_name), AppNotInstalledError) modulename = ".".join(method_string.split(".")[:-1]) methodname = method_string.split(".")[-1] * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/UTILS/CACHING.PY", LINE 57, IN WRAPPER return func(*args, **kwargs) try: return frappe.local.request_cache[func][args_key] except KeyError: return_val = func(*args, **kwargs) frappe.local.request_cache[func][args_key] = return_val return return_val return wrapper * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/__INIT__.PY", LINE 1507, IN GET_INSTALLED_APPS return [] if not db: connect() installed = json.loads(db.get_global("installed_apps") or "[]") if _ensure_on_bench: all_apps = cache.get_value("all_apps", get_all_apps) installed = [app for app in installed if app in all_apps] * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 991, IN GET_GLOBAL """Save a global key value. Global values will be automatically set if they match fieldname.""" self.set_default(key, val, user) def get_global(self, key, user="__global"): """Returns a global key value.""" return self.get_default(key, user) def get_default(self, key, parent="__default"): """Returns default value as a list if multiple or single""" d = self.get_defaults(key, parent) return isinstance(d, list) and d[0] or d * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 995, IN GET_DEFAULT """Returns a global key value.""" return self.get_default(key, user) def get_default(self, key, parent="__default"): """Returns default value as a list if multiple or single""" d = self.get_defaults(key, parent) return isinstance(d, list) and d[0] or d @staticmethod def set_default(key, val, parent="__default", parenttype=None): """Sets a global / user default value.""" * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 1011, IN GET_DEFAULTS frappe.defaults.add_default(key, val, parent, parenttype) @staticmethod def get_defaults(key=None, parent="__default"): """Get all defaults""" defaults = frappe.defaults.get_defaults_for(parent) if not key: return defaults if key in defaults: return defaults[key] * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DEFAULTS.PY", LINE 236, IN GET_DEFAULTS_FOR if defaults is None: # sort descending because first default must get precedence table = DocType("DefaultValue") res = ( frappe.qb.from_(table) .where(table.parent == parent) .select(table.defkey, table.defvalue) .orderby("creation") .run(as_dict=True) ) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/QUERY_BUILDER/UTILS.PY", LINE 87, IN EXECUTE_QUERY """ def execute_query(query, *args, **kwargs): child_queries = query._child_queries if isinstance(query._child_queries, list) else [] query, params = prepare_query(query) result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep execute_child_queries(child_queries, result) return result def execute_child_queries(queries, result): if not queries or not result or not isinstance(result[0], dict) or not result[0].name: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 212, IN SQL # replaces ifnull in query with coalesce query = IFNULL_PATTERN.sub("coalesce(", query) if not self._conn: self.connect() # in transaction validations self.check_transaction_status(query) self.clear_db_table_cache(query) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 118, IN CONNECT pass def connect(self): """Connects to a database as set in `site_config.json`.""" self.cur_db_name = self.user self._conn: Union["MariadbConnection", "PostgresConnection"] = self.get_connection() self._cursor: Union["MariadbCursor", "PostgresCursor"] = self._conn.cursor() try: if execution_timeout := get_query_execution_timeout(): self.set_execution_timeout(execution_timeout) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 103, IN GET_CONNECTION ) class MariaDBConnectionUtil: def get_connection(self): conn = self._get_connection() conn.auto_reconnect = True return conn def _get_connection(self): """Return MariaDB connection object.""" * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 109, IN _GET_CONNECTION conn.auto_reconnect = True return conn def _get_connection(self): """Return MariaDB connection object.""" return self.create_connection() def create_connection(self): return pymysql.connect(**self.get_connection_settings()) def set_execution_timeout(self, seconds: int): * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 112, IN CREATE_CONNECTION def _get_connection(self): """Return MariaDB connection object.""" return self.create_connection() def create_connection(self): return pymysql.connect(**self.get_connection_settings()) def set_execution_timeout(self, seconds: int): self.sql("set session max_statement_time = %s", int(seconds)) def get_connection_settings(self) -> dict: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 358, IN __INIT__ self._connect_attrs["program_name"] = program_name if defer_connect: self._sock = None else: self.connect() def __enter__(self): return self def __exit__(self, *exc_info): * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 664, IN CONNECT self._sock = sock self._rfile = sock.makefile("rb") self._next_seq_id = 0 self._get_server_information() self._request_authentication() # Send "SET NAMES" query on init for: # - Ensure charaset (and collation) is set to the server. # - collation_id in handshake packet may be ignored. # - If collation is not specified, we don't know what is server's * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 954, IN _REQUEST_AUTHENTICATION v = v.encode("utf-8") connect_attrs += _lenenc_int(len(v)) + v data += _lenenc_int(len(connect_attrs)) + connect_attrs self.write_packet(data) auth_packet = self._read_packet() # if authentication method isn't accepted the first byte # will have the octet 254 if auth_packet.is_auth_switch_request(): if DEBUG: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 772, IN _READ_PACKET packet = packet_type(bytes(buff), self.encoding) if packet.is_error_packet(): if self._result is not None and self._result.unbuffered_active is True: self._result.unbuffered_active = False packet.raise_for_error() return packet def _read_bytes(self, num_bytes): self._sock.settimeout(self._read_timeout) while True: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/PROTOCOL.PY", LINE 221, IN RAISE_FOR_ERROR self.rewind() self.advance(1) # field_count == error (we already know that) errno = self.read_uint16() if DEBUG: print("errno =", errno) err.raise_mysql_exception(self._data) def dump(self): dump_packet(self._data) * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/ERR.PY", LINE 143, IN RAISE_MYSQL_EXCEPTION errno = struct.unpack("<h", data[1:3])[0] errval = data[9:].decode("utf-8", "replace") errorclass = error_map.get(errno) if errorclass is None: errorclass = InternalError if errno < 1000 else OperationalError raise errorclass(errno, errval) * During handling of the above exception, another exception occurred: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/SERVE.PY", LINE 17, IN GET_RESPONSE path = path or frappe.local.request.path endpoint = path try: path_resolver = PathResolver(path, http_status_code) endpoint, renderer_instance = path_resolver.resolve() response = renderer_instance.render() except frappe.Redirect: return RedirectPage(endpoint or path, http_status_code).render() except frappe.PermissionError as e: response = NotPermittedPage(endpoint, http_status_code, exception=e).render() * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/PATH_RESOLVER.PY", LINE 37, IN RESOLVE # check if the request url is in 404 list if request.url and can_cache() and frappe.cache.hget("website_404", request.url): return self.path, NotFoundPage(self.path) try: resolve_redirect(self.path, request.query_string) except frappe.Redirect: return frappe.flags.redirect_location, RedirectPage(self.path) if frappe.get_hooks("website_path_resolver"): for handler in frappe.get_hooks("website_path_resolver"): * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/PATH_RESOLVER.PY", LINE 112, IN RESOLVE_REDIRECT {"source": r"/from/(.*)", "target": r"/main/\1"} # use r as a string prefix if you use regex groups or want to escape any string literal ] """ redirects = frappe.get_hooks("website_redirects") redirects += frappe.get_all("Website Route Redirect", ["source", "target"], order_by=None) if not redirects: return redirect_to = frappe.cache.hget("website_redirects", path) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/__INIT__.PY", LINE 1970, IN GET_ALL frappe.get_all("ToDo", fields=["*"], filters = [["modified", ">", "2014-01-01"]]) """ kwargs["ignore_permissions"] = True if not "limit_page_length" in kwargs: kwargs["limit_page_length"] = 0 return get_list(doctype, *args, **kwargs) def get_value(*args, **kwargs): """Returns a document property or list of properties. * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/__INIT__.PY", LINE 1945, IN GET_LIST # filter as a list of lists frappe.get_list("ToDo", fields="*", filters = [["modified", ">", "2014-01-01"]]) """ import frappe.model.db_query return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs) def get_all(doctype, *args, **kwargs): """List database query via `frappe.model.db_query`. Will **not** check for permissions. Parameters are same as `frappe.get_list` * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/MODEL/DB_QUERY.PY", LINE 179, IN EXECUTE self.reference_doctype = reference_doctype or self.doctype if user_settings: self.user_settings = json.loads(user_settings) if is_virtual_doctype(self.doctype): from frappe.model.base_document import get_controller controller = get_controller(self.doctype) if not hasattr(controller, "get_list"): return [] * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/UTILS/CACHING.PY", LINE 119, IN SITE_CACHE_WRAPPER _SITE_CACHE[func_key][frappe.local.site].pop( next(iter(_SITE_CACHE[func_key][frappe.local.site])), None ) if func_call_key not in _SITE_CACHE[func_key][frappe.local.site]: _SITE_CACHE[func_key][frappe.local.site][func_call_key] = func(*args, **kwargs) return _SITE_CACHE[func_key][frappe.local.site][func_call_key] return func(*args, **kwargs) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/MODEL/UTILS/__INIT__.PY", LINE 134, IN IS_VIRTUAL_DOCTYPE @site_cache() def is_virtual_doctype(doctype: str): if frappe.db.has_column("DocType", "is_virtual"): return frappe.db.get_value("DocType", doctype, "is_virtual") return False @site_cache() def is_single_doctype(doctype: str) -> bool: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 516, IN GET_VALUE # returns default date_format frappe.db.get_value("System Settings", None, "date_format") """ result = self.get_values( doctype, filters, fieldname, ignore, as_dict, * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 617, IN GET_VALUES if (filters is not None) and (filters != doctype or doctype == "DocType"): try: if order_by: order_by = "modified" if order_by == DefaultOrderBy else order_by out = self._get_values_from_table( fields=fields, filters=filters, doctype=doctype, as_dict=as_dict, debug=debug, * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 884, IN _GET_VALUES_FROM_TABLE validate_filters=True, ) if isinstance(fields, str) and fields == "*": as_dict = True return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck) def _get_value_for_many_names( self, doctype, names, * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/QUERY_BUILDER/UTILS.PY", LINE 87, IN EXECUTE_QUERY """ def execute_query(query, *args, **kwargs): child_queries = query._child_queries if isinstance(query._child_queries, list) else [] query, params = prepare_query(query) result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep execute_child_queries(child_queries, result) return result def execute_child_queries(queries, result): if not queries or not result or not isinstance(result[0], dict) or not result[0].name: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 212, IN SQL # replaces ifnull in query with coalesce query = IFNULL_PATTERN.sub("coalesce(", query) if not self._conn: self.connect() # in transaction validations self.check_transaction_status(query) self.clear_db_table_cache(query) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 118, IN CONNECT pass def connect(self): """Connects to a database as set in `site_config.json`.""" self.cur_db_name = self.user self._conn: Union["MariadbConnection", "PostgresConnection"] = self.get_connection() self._cursor: Union["MariadbCursor", "PostgresCursor"] = self._conn.cursor() try: if execution_timeout := get_query_execution_timeout(): self.set_execution_timeout(execution_timeout) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 103, IN GET_CONNECTION ) class MariaDBConnectionUtil: def get_connection(self): conn = self._get_connection() conn.auto_reconnect = True return conn def _get_connection(self): """Return MariaDB connection object.""" * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 109, IN _GET_CONNECTION conn.auto_reconnect = True return conn def _get_connection(self): """Return MariaDB connection object.""" return self.create_connection() def create_connection(self): return pymysql.connect(**self.get_connection_settings()) def set_execution_timeout(self, seconds: int): * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 112, IN CREATE_CONNECTION def _get_connection(self): """Return MariaDB connection object.""" return self.create_connection() def create_connection(self): return pymysql.connect(**self.get_connection_settings()) def set_execution_timeout(self, seconds: int): self.sql("set session max_statement_time = %s", int(seconds)) def get_connection_settings(self) -> dict: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 358, IN __INIT__ self._connect_attrs["program_name"] = program_name if defer_connect: self._sock = None else: self.connect() def __enter__(self): return self def __exit__(self, *exc_info): * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 664, IN CONNECT self._sock = sock self._rfile = sock.makefile("rb") self._next_seq_id = 0 self._get_server_information() self._request_authentication() # Send "SET NAMES" query on init for: # - Ensure charaset (and collation) is set to the server. # - collation_id in handshake packet may be ignored. # - If collation is not specified, we don't know what is server's * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 954, IN _REQUEST_AUTHENTICATION v = v.encode("utf-8") connect_attrs += _lenenc_int(len(v)) + v data += _lenenc_int(len(connect_attrs)) + connect_attrs self.write_packet(data) auth_packet = self._read_packet() # if authentication method isn't accepted the first byte # will have the octet 254 if auth_packet.is_auth_switch_request(): if DEBUG: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 772, IN _READ_PACKET packet = packet_type(bytes(buff), self.encoding) if packet.is_error_packet(): if self._result is not None and self._result.unbuffered_active is True: self._result.unbuffered_active = False packet.raise_for_error() return packet def _read_bytes(self, num_bytes): self._sock.settimeout(self._read_timeout) while True: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/PROTOCOL.PY", LINE 221, IN RAISE_FOR_ERROR self.rewind() self.advance(1) # field_count == error (we already know that) errno = self.read_uint16() if DEBUG: print("errno =", errno) err.raise_mysql_exception(self._data) def dump(self): dump_packet(self._data) * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/ERR.PY", LINE 143, IN RAISE_MYSQL_EXCEPTION errno = struct.unpack("<h", data[1:3])[0] errval = data[9:].decode("utf-8", "replace") errorclass = error_map.get(errno) if errorclass is None: errorclass = InternalError if errno < 1000 else OperationalError raise errorclass(errno, errval) * During handling of the above exception, another exception occurred: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/UTILS/CACHING.PY", LINE 55, IN WRAPPER args_key = __generate_request_cache_key(args, kwargs) except Exception: return func(*args, **kwargs) try: return frappe.local.request_cache[func][args_key] except KeyError: return_val = func(*args, **kwargs) frappe.local.request_cache[func][args_key] = return_val return return_val * During handling of the above exception, another exception occurred: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/MIDDLEWARES.PY", LINE 16, IN __CALL__ class StaticDataMiddleware(SharedDataMiddleware): def __call__(self, environ, start_response): self.environ = environ return super().__call__(environ, start_response) def get_directory_loader(self, directory): def loader(path): site = get_site_name(frappe.app._site or self.environ.get("HTTP_HOST")) path = os.path.join(directory, site, "public", "files", cstr(path)) * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/WERKZEUG/MIDDLEWARE/SHARED_DATA.PY", LINE 249, IN __CALL__ if file_loader is not None: break if file_loader is None or not self.is_allowed(real_filename): # type: ignore return self.app(environ, start_response) guessed_type = mimetypes.guess_type(real_filename) # type: ignore mime_type = get_content_type(guessed_type[0] or self.fallback_mimetype, "utf-8") f, mtime, file_size = file_loader() * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/WERKZEUG/MIDDLEWARE/SHARED_DATA.PY", LINE 249, IN __CALL__ if file_loader is not None: break if file_loader is None or not self.is_allowed(real_filename): # type: ignore return self.app(environ, start_response) guessed_type = mimetypes.guess_type(real_filename) # type: ignore mime_type = get_content_type(guessed_type[0] or self.fallback_mimetype, "utf-8") f, mtime, file_size = file_loader() * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/APP.PY", LINE 74, IN APPLICATION This is done to reduce response time by deferring expensive tasks.""" @functools.wraps(app) def application(environ, start_response): return ClosingIterator( app(environ, start_response), ( frappe.rate_limiter.update, frappe.monitor.stop, frappe.recorder.dump, frappe.request.after_response.run, * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/WERKZEUG/WRAPPERS/REQUEST.PY", LINE 189, IN APPLICATION @functools.wraps(f) def application(*args): # type: ignore request = cls(args[-2]) with request: try: resp = f(*args[:-2] + (request,)) except HTTPException as e: resp = e.get_response(args[-2]) return resp(*args[-2:]) return t.cast("WSGIApplication", application) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/APP.PY", LINE 128, IN APPLICATION except HTTPException as e: return e except Exception as e: response = handle_exception(e) else: rollback = sync_database(rollback) finally: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/APP.PY", LINE 392, IN HANDLE_EXCEPTION if http_status_code >= 500: log_error_snapshot(e) if return_as_message: response = get_response("message", http_status_code=http_status_code) if frappe.conf.get("developer_mode") and not respond_as_json: # don't fail silently for non-json response errors print(frappe.get_traceback()) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/SERVE.PY", LINE 26, IN GET_RESPONSE except frappe.PermissionError as e: response = NotPermittedPage(endpoint, http_status_code, exception=e).render() except frappe.PageDoesNotExistError: response = NotFoundPage(endpoint, http_status_code).render() except Exception as e: response = ErrorPage(exception=e).render() return response def get_response_content(path=None, http_status_code=200): * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/PAGE_RENDERERS/ERROR_PAGE.PY", LINE 7, IN __INIT__ class ErrorPage(TemplatePage): def __init__(self, path=None, http_status_code=None, exception=None): path = "error" super().__init__(path=path, http_status_code=http_status_code) self.exception = exception def can_render(self): return True * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/PAGE_RENDERERS/TEMPLATE_PAGE.PY", LINE 45, IN __INIT__ class TemplatePage(BaseTemplatePage): def __init__(self, path, http_status_code=None): super().__init__(path=path, http_status_code=http_status_code) self.set_template_path() def set_template_path(self): """ Searches for file matching the path in the /www and /templates/pages folders and sets path if match is found * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/WEBSITE/PAGE_RENDERERS/TEMPLATE_PAGE.PY", LINE 53, IN SET_TEMPLATE_PATH """ Searches for file matching the path in the /www and /templates/pages folders and sets path if match is found """ folders = get_start_folders() for app in reversed(frappe.get_installed_apps()): app_path = frappe.get_app_path(app) for dirname in folders: search_path = os.path.join(app_path, dirname, self.path) for file_path in self.get_index_path_options(search_path): * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/UTILS/CACHING.PY", LINE 57, IN WRAPPER return func(*args, **kwargs) try: return frappe.local.request_cache[func][args_key] except KeyError: return_val = func(*args, **kwargs) frappe.local.request_cache[func][args_key] = return_val return return_val return wrapper * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/__INIT__.PY", LINE 1507, IN GET_INSTALLED_APPS return [] if not db: connect() installed = json.loads(db.get_global("installed_apps") or "[]") if _ensure_on_bench: all_apps = cache.get_value("all_apps", get_all_apps) installed = [app for app in installed if app in all_apps] * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 991, IN GET_GLOBAL """Save a global key value. Global values will be automatically set if they match fieldname.""" self.set_default(key, val, user) def get_global(self, key, user="__global"): """Returns a global key value.""" return self.get_default(key, user) def get_default(self, key, parent="__default"): """Returns default value as a list if multiple or single""" d = self.get_defaults(key, parent) return isinstance(d, list) and d[0] or d * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 995, IN GET_DEFAULT """Returns a global key value.""" return self.get_default(key, user) def get_default(self, key, parent="__default"): """Returns default value as a list if multiple or single""" d = self.get_defaults(key, parent) return isinstance(d, list) and d[0] or d @staticmethod def set_default(key, val, parent="__default", parenttype=None): """Sets a global / user default value.""" * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 1011, IN GET_DEFAULTS frappe.defaults.add_default(key, val, parent, parenttype) @staticmethod def get_defaults(key=None, parent="__default"): """Get all defaults""" defaults = frappe.defaults.get_defaults_for(parent) if not key: return defaults if key in defaults: return defaults[key] * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DEFAULTS.PY", LINE 236, IN GET_DEFAULTS_FOR if defaults is None: # sort descending because first default must get precedence table = DocType("DefaultValue") res = ( frappe.qb.from_(table) .where(table.parent == parent) .select(table.defkey, table.defvalue) .orderby("creation") .run(as_dict=True) ) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/QUERY_BUILDER/UTILS.PY", LINE 87, IN EXECUTE_QUERY """ def execute_query(query, *args, **kwargs): child_queries = query._child_queries if isinstance(query._child_queries, list) else [] query, params = prepare_query(query) result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep execute_child_queries(child_queries, result) return result def execute_child_queries(queries, result): if not queries or not result or not isinstance(result[0], dict) or not result[0].name: * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 212, IN SQL # replaces ifnull in query with coalesce query = IFNULL_PATTERN.sub("coalesce(", query) if not self._conn: self.connect() # in transaction validations self.check_transaction_status(query) self.clear_db_table_cache(query) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/DATABASE.PY", LINE 118, IN CONNECT pass def connect(self): """Connects to a database as set in `site_config.json`.""" self.cur_db_name = self.user self._conn: Union["MariadbConnection", "PostgresConnection"] = self.get_connection() self._cursor: Union["MariadbCursor", "PostgresCursor"] = self._conn.cursor() try: if execution_timeout := get_query_execution_timeout(): self.set_execution_timeout(execution_timeout) * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 103, IN GET_CONNECTION ) class MariaDBConnectionUtil: def get_connection(self): conn = self._get_connection() conn.auto_reconnect = True return conn def _get_connection(self): """Return MariaDB connection object.""" * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 109, IN _GET_CONNECTION conn.auto_reconnect = True return conn def _get_connection(self): """Return MariaDB connection object.""" return self.create_connection() def create_connection(self): return pymysql.connect(**self.get_connection_settings()) def set_execution_timeout(self, seconds: int): * FILE "/WORKSPACE/FRAPPE-15/APPS/FRAPPE/FRAPPE/DATABASE/MARIADB/DATABASE.PY", LINE 112, IN CREATE_CONNECTION def _get_connection(self): """Return MariaDB connection object.""" return self.create_connection() def create_connection(self): return pymysql.connect(**self.get_connection_settings()) def set_execution_timeout(self, seconds: int): self.sql("set session max_statement_time = %s", int(seconds)) def get_connection_settings(self) -> dict: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 358, IN __INIT__ self._connect_attrs["program_name"] = program_name if defer_connect: self._sock = None else: self.connect() def __enter__(self): return self def __exit__(self, *exc_info): * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 664, IN CONNECT self._sock = sock self._rfile = sock.makefile("rb") self._next_seq_id = 0 self._get_server_information() self._request_authentication() # Send "SET NAMES" query on init for: # - Ensure charaset (and collation) is set to the server. # - collation_id in handshake packet may be ignored. # - If collation is not specified, we don't know what is server's * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 954, IN _REQUEST_AUTHENTICATION v = v.encode("utf-8") connect_attrs += _lenenc_int(len(v)) + v data += _lenenc_int(len(connect_attrs)) + connect_attrs self.write_packet(data) auth_packet = self._read_packet() # if authentication method isn't accepted the first byte # will have the octet 254 if auth_packet.is_auth_switch_request(): if DEBUG: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/CONNECTIONS.PY", LINE 772, IN _READ_PACKET packet = packet_type(bytes(buff), self.encoding) if packet.is_error_packet(): if self._result is not None and self._result.unbuffered_active is True: self._result.unbuffered_active = False packet.raise_for_error() return packet def _read_bytes(self, num_bytes): self._sock.settimeout(self._read_timeout) while True: * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/PROTOCOL.PY", LINE 221, IN RAISE_FOR_ERROR self.rewind() self.advance(1) # field_count == error (we already know that) errno = self.read_uint16() if DEBUG: print("errno =", errno) err.raise_mysql_exception(self._data) def dump(self): dump_packet(self._data) * FILE "/WORKSPACE/FRAPPE-15/ENV/LIB/PYTHON3.10/SITE-PACKAGES/PYMYSQL/ERR.PY", LINE 143, IN RAISE_MYSQL_EXCEPTION errno = struct.unpack("<h", data[1:3])[0] errval = data[9:].decode("utf-8", "replace") errorclass = error_map.get(errno) if errorclass is None: errorclass = InternalError if errno < 1000 else OperationalError raise errorclass(errno, errval) > pymysql.err.OperationalError: (1045, "Access denied for user > '_5138a6940bc28cb7'@'10.1.202.79' (using password: YES)") This is the Copy/Paste friendly version of the traceback. Traceback (most recent call last): File "/workspace/frappe-15/apps/frappe/frappe/utils/caching.py", line 55, in wrapper return frappe.local.request_cache[func][args_key] KeyError: 5740354900026072187 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/workspace/frappe-15/apps/frappe/frappe/app.py", line 95, in application init_request(request) File "/workspace/frappe-15/apps/frappe/frappe/app.py", line 194, in init_request frappe.call(before_request_task) File "/workspace/frappe-15/apps/frappe/frappe/__init__.py", line 1678, in call fn = get_attr(fn) File "/workspace/frappe-15/apps/frappe/frappe/__init__.py", line 1666, in get_attr and app_name not in get_installed_apps() File "/workspace/frappe-15/apps/frappe/frappe/utils/caching.py", line 57, in wrapper return_val = func(*args, **kwargs) File "/workspace/frappe-15/apps/frappe/frappe/__init__.py", line 1507, in get_installed_apps installed = json.loads(db.get_global("installed_apps") or "[]") File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 991, in get_global return self.get_default(key, user) File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 995, in get_default d = self.get_defaults(key, parent) File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 1011, in get_defaults defaults = frappe.defaults.get_defaults_for(parent) File "/workspace/frappe-15/apps/frappe/frappe/defaults.py", line 236, in get_defaults_for frappe.qb.from_(table) File "/workspace/frappe-15/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 212, in sql self.connect() File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 118, in connect self._conn: Union["MariadbConnection", "PostgresConnection"] = self.get_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 103, in get_connection conn = self._get_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 109, in _get_connection return self.create_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 112, in create_connection return pymysql.connect(**self.get_connection_settings()) File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 358, in __init__ self.connect() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 664, in connect self._request_authentication() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 954, in _request_authentication auth_packet = self._read_packet() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet packet.raise_for_error() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1045, "Access denied for user '_5138a6940bc28cb7'@'10.1.202.79' (using password: YES)") During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/workspace/frappe-15/apps/frappe/frappe/website/serve.py", line 17, in get_response endpoint, renderer_instance = path_resolver.resolve() File "/workspace/frappe-15/apps/frappe/frappe/website/path_resolver.py", line 37, in resolve resolve_redirect(self.path, request.query_string) File "/workspace/frappe-15/apps/frappe/frappe/website/path_resolver.py", line 112, in resolve_redirect redirects += frappe.get_all("Website Route Redirect", ["source", "target"], order_by=None) File "/workspace/frappe-15/apps/frappe/frappe/__init__.py", line 1970, in get_all return get_list(doctype, *args, **kwargs) File "/workspace/frappe-15/apps/frappe/frappe/__init__.py", line 1945, in get_list return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs) File "/workspace/frappe-15/apps/frappe/frappe/model/db_query.py", line 179, in execute if is_virtual_doctype(self.doctype): File "/workspace/frappe-15/apps/frappe/frappe/utils/caching.py", line 119, in site_cache_wrapper _SITE_CACHE[func_key][frappe.local.site][func_call_key] = func(*args, **kwargs) File "/workspace/frappe-15/apps/frappe/frappe/model/utils/__init__.py", line 134, in is_virtual_doctype return frappe.db.get_value("DocType", doctype, "is_virtual") File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 516, in get_value result = self.get_values( File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 617, in get_values out = self._get_values_from_table( File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 884, in _get_values_from_table return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck) File "/workspace/frappe-15/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 212, in sql self.connect() File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 118, in connect self._conn: Union["MariadbConnection", "PostgresConnection"] = self.get_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 103, in get_connection conn = self._get_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 109, in _get_connection return self.create_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 112, in create_connection return pymysql.connect(**self.get_connection_settings()) File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 358, in __init__ self.connect() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 664, in connect self._request_authentication() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 954, in _request_authentication auth_packet = self._read_packet() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet packet.raise_for_error() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1045, "Access denied for user '_5138a6940bc28cb7'@'10.1.202.79' (using password: YES)") During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/workspace/frappe-15/apps/frappe/frappe/utils/caching.py", line 55, in wrapper return frappe.local.request_cache[func][args_key] KeyError: 5740354900026072187 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/workspace/frappe-15/apps/frappe/frappe/middlewares.py", line 16, in __call__ return super().__call__(environ, start_response) File "/workspace/frappe-15/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py", line 249, in __call__ return self.app(environ, start_response) File "/workspace/frappe-15/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py", line 249, in __call__ return self.app(environ, start_response) File "/workspace/frappe-15/apps/frappe/frappe/app.py", line 74, in application app(environ, start_response), File "/workspace/frappe-15/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py", line 189, in application resp = f(*args[:-2] + (request,)) File "/workspace/frappe-15/apps/frappe/frappe/app.py", line 128, in application response = handle_exception(e) File "/workspace/frappe-15/apps/frappe/frappe/app.py", line 392, in handle_exception response = get_response("message", http_status_code=http_status_code) File "/workspace/frappe-15/apps/frappe/frappe/website/serve.py", line 26, in get_response response = ErrorPage(exception=e).render() File "/workspace/frappe-15/apps/frappe/frappe/website/page_renderers/error_page.py", line 7, in __init__ super().__init__(path=path, http_status_code=http_status_code) File "/workspace/frappe-15/apps/frappe/frappe/website/page_renderers/template_page.py", line 45, in __init__ self.set_template_path() File "/workspace/frappe-15/apps/frappe/frappe/website/page_renderers/template_page.py", line 53, in set_template_path for app in reversed(frappe.get_installed_apps()): File "/workspace/frappe-15/apps/frappe/frappe/utils/caching.py", line 57, in wrapper return_val = func(*args, **kwargs) File "/workspace/frappe-15/apps/frappe/frappe/__init__.py", line 1507, in get_installed_apps installed = json.loads(db.get_global("installed_apps") or "[]") File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 991, in get_global return self.get_default(key, user) File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 995, in get_default d = self.get_defaults(key, parent) File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 1011, in get_defaults defaults = frappe.defaults.get_defaults_for(parent) File "/workspace/frappe-15/apps/frappe/frappe/defaults.py", line 236, in get_defaults_for frappe.qb.from_(table) File "/workspace/frappe-15/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 212, in sql self.connect() File "/workspace/frappe-15/apps/frappe/frappe/database/database.py", line 118, in connect self._conn: Union["MariadbConnection", "PostgresConnection"] = self.get_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 103, in get_connection conn = self._get_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 109, in _get_connection return self.create_connection() File "/workspace/frappe-15/apps/frappe/frappe/database/mariadb/database.py", line 112, in create_connection return pymysql.connect(**self.get_connection_settings()) File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 358, in __init__ self.connect() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 664, in connect self._request_authentication() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 954, in _request_authentication auth_packet = self._read_packet() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet packet.raise_for_error() File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "/workspace/frappe-15/env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1045, "Access denied for user '_5138a6940bc28cb7'@'10.1.202.79' (using password: YES)") The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: * dump() shows all variables in the frame * dump(obj) dumps all that's known about the object Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter. CONSOLE LOCKED The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server. PIN: