ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Attach File in Web Form Child Table fails


#1

Hi all,

I observe the following issue: I have a custom doctype “request”, which has a child table “request file”, which has a field of type “Attach”. In the desk version, this works nicely to attach multiple files to the doctype record.

Now, I have a web form for the same doctype to allow portal users to place requests and attach files. The form works well, however, as soon as a file is attached, saving is no longer possible and the console shows the following error message:

Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)
frappe-web.min.js:960 Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
	response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
	data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
	return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 939, in call
	return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/web_form/web_form.py", line 401, in accept
	doc.insert(ignore_permissions = True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 240, in insert
	d.db_insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 303, in db_insert
	), list(d.values()))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 166, in sql
	self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 170, in execute
	result = self._query(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 328, in _query
	conn.query(q)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 516, in query
	self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 727, in _read_query_result
	result.read()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1066, in read
	first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
	packet.check_error()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
	err.raise_mysql_exception(self._data)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
	raise errorclass(errno, errval)
ProgrammingError: (1064, u'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \': \'1\', u\'dataurl\': u"\'data:application/pdf;base64,JVBERi0xLjUNJeLjz9MNCjE3IDAgb2\' at line 2')

This is observed in ERPNext: v10.1.52 / Frappe Framework: v10.1.47

Is this a known issue? Any workarounds/solutions?


#2

Linking the corresponding GitHub issue for reference: