The code in CustomScript (ajax POST request - GET works fine!):
frappe.ui.form.on(“ToDo”, “description”, function (frm) {
$.ajax({ url: encodeURI("/api/resource/Customer"), type: "post", beforeSend: function(xhr) { xhr.setRequestHeader("X-Frappe-CSRF-Token", frappe.csrf_token); xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
}, data: {} });
});
//# sourceURL=debug_me.js
Need tip how to debug this kind of error:
Traceback (most recent call last):
File “/home/marcin/frappe-bench/apps/frappe/frappe/middlewares.py”, line 15, in call
return super(StaticDataMiddleware, self).call(environ, start_response)
File “/home/marcin/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 599, in call
return self.app(environ, start_response)
File “/home/marcin/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 599, in call
return self.app(environ, start_response)
File “/home/marcin/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py”, line 228, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/home/marcin/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 291, in application
return f(*args[:-2] + (request,))(*args[-2:])
File “/home/marcin/frappe-bench/apps/frappe/frappe/app.py”, line 80, in application
response = handle_exception(e)
File “/home/marcin/frappe-bench/apps/frappe/frappe/app.py”, line 135, in handle_exception
response = frappe.utils.response.report_error(http_status_code)
File “/home/marcin/frappe-bench/apps/frappe/frappe/utils/response.py”, line 24, in report_error
frappe.errprint(frappe.utils.get_traceback())
File “/home/marcin/frappe-bench/apps/frappe/frappe/init.py”, line 229, in errprint
print cstr(msg)
IOError: [Errno 32] Broken pipe
This only happens on POST requests, the data provided does not seem to have any impact on this request.