Error on saving of `Event Producer` : Server Error : frappe.exceptions.PermissionError: Not permitted
See original GitHub issueDescription of the issue
Event streaming doesnot work. As on save of Event Producer exception is thrown
Context information (for bug reports)
Output of bench version
erpnext 13.2.1
frappe 13.2.1
Steps to reproduce the issue
- Go to http://localhost:8002/app/event-producer/new-event-producer-1
- Fill up all the required fields
- Click onn save. It throws exception
Observed result
frappe.exceptions.PermissionError: Not permitted
Expected result
No error should be thrown on saving
Stacktrace / full error message
Traceback (most recent call last): File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 21, in savedocs doc.save() File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 284, in save return self._save(*args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 306, in _save self.insert() File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert self.run_method(“before_insert”) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 858, in run_method out = Document.hook(fn)(self, *args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1147, in composer return composed(self, method, *args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1130, in runner add_to_return_value(self, fn(self, *args, **kwargs)) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 852, in <lambda> fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py”, line 25, in before_insert self.create_event_consumer() File “/home/frappe/frappe-bench/apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py”, line 77, in create_event_consumer params={‘data’: json.dumps(self.get_request_data())} File “/home/frappe/frappe-bench/apps/frappe/frappe/frappeclient.py”, line 299, in post_api return self.post_process(res) File “/home/frappe/frappe-bench/apps/frappe/frappe/frappeclient.py”, line 333, in post_process raise FrappeException(exc) frappe.frappeclient.FrappeException: FrappeClient Request Failed
Traceback (most recent call last): File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 68, in application response = frappe.api.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 54, in handle return frappe.handler.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 31, in handle data = execute_cmd(cmd) File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 64, in execute_cmd is_whitelisted(method) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 588, in is_whitelisted throw(_(“Not permitted”), PermissionError) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 427, in throw msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 406, in msgprint _raise_exception() File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 360, in _raise_exception raise raise_exception(msg) frappe.exceptions.PermissionError: Not permitted
request.js:387 Traceback (most recent call last): File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 68, in application response = frappe.api.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 54, in handle return frappe.handler.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 31, in handle data = execute_cmd(cmd) File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 67, in execute_cmd return frappe.call(method, **frappe.form_dict) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1169, in call return fn(*args, **newargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 21, in savedocs doc.save() File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 284, in save return self._save(*args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 306, in _save self.insert() File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert self.run_method(“before_insert”) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 858, in run_method out = Document.hook(fn)(self, *args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1147, in composer return composed(self, method, *args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1130, in runner add_to_return_value(self, fn(self, *args, **kwargs)) File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 852, in <lambda> fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs) File “/home/frappe/frappe-bench/apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py”, line 25, in before_insert self.create_event_consumer() File “/home/frappe/frappe-bench/apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py”, line 77, in create_event_consumer params={‘data’: json.dumps(self.get_request_data())} File “/home/frappe/frappe-bench/apps/frappe/frappe/frappeclient.py”, line 299, in post_api return self.post_process(res) File “/home/frappe/frappe-bench/apps/frappe/frappe/frappeclient.py”, line 333, in post_process raise FrappeException(exc) frappe.frappeclient.FrappeException: FrappeClient Request Failed
Traceback (most recent call last): File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 68, in application response = frappe.api.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 54, in handle return frappe.handler.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 31, in handle data = execute_cmd(cmd) File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 64, in execute_cmd is_whitelisted(method) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 588, in is_whitelisted throw(_(“Not permitted”), PermissionError) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 427, in throw msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list) File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 406, in msgprint _raise_exception() File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 360, in _raise_exception raise raise_exception(msg) frappe.exceptions.PermissionError: Not permitted
(paste here)
Additional information
OS version / distribution, ERPNext
install method, etc.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Hello, this issue is not related to Event Streaming but to FrappeClient, it got fixed recently, more info: https://github.com/frappe/frappe/pull/12998
Not able to replicate this issue locally. Seems to be production-specific. Will investigate. Does your event subscriber user have permission to create an Event Producer on the consumer site?