Woo integration Error 500 while saving webhook - REST API

Hi guys,
We are trying to setup Erpnext with woocommerce. Newest version of Erpnext and woocommerce, completely fresh installations.

Every time we save the webhook we get the following error: Error: Delivery URL returned response code: 500

Placing on order gives us the following error in the log:

[Response] => Array
        [Code] => 500
        [Message] => Internal Server Error
        [Headers] => Requests_Utility_CaseInsensitiveDictionary Object
                [data:protected] => Array
                        [server] => nginx/1.14.2
                        [date] => Sun, 30 Jan 2022 20:39:43 GMT
                        [content-type] => application/json
                        [content-length] => 3188
                        [set-cookie] => Array
                                [0] => sid=Guest; Expires=Wed, 02-Feb-2022 20:39:43 GMT; Secure; HttpOnly; Path=/; SameSite=Lax
                                [1] => system_user=no; Secure; Path=/; SameSite=Lax
                                [2] => full_name=Guest; Secure; Path=/; SameSite=Lax
                                [3] => user_id=Guest; Secure; Path=/; SameSite=Lax
                                [4] => user_image=; Secure; Path=/; SameSite=Lax



        [Body] => {"exception":"pymysql.err.OperationalError: (1054, \"Unknown column 'woocommerce_email' in 'where clause'\")","exc":"[\"Traceback (most recent call last):\\n  File \\\"apps/frappe/frappe/app.py\\\", line 68, in application\\n    response = frappe.api.handle()\\n  File \\\"apps/frappe/frappe/api.py\\\", line 55, in handle\\n    return frappe.handler.handle()\\n  File \\\"apps/frappe/frappe/handler.py\\\", line 31, in handle\\n    data = execute_cmd(cmd)\\n  File \\\"apps/frappe/frappe/handler.py\\\", line 68, in execute_cmd\\n    return frappe.call(method, **frappe.form_dict)\\n  File \\\"apps/frappe/frappe/__init__.py\\\", line 1208, in call\\n    return fn(*args, **newargs)\\n  File \\\"apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py\\\", line 31, in order\\n    _order(*args, **kwargs)\\n  File \\\"apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py\\\", line 60, in _order\\n    link_customer_and_address(raw_billing_data, raw_shipping_data, customer_name)\\n  File \\\"apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py\\\", line 66, in link_customer_and_address\\n    customer_exists = frappe.get_value(\\\"Customer\\\", {\\\"woocommerce_email\\\": customer_woo_com_email})\\n  File \\\"apps/frappe/frappe/__init__.py\\\", line 1483, in get_value\\n    return db.get_value(*args, **kwargs)\\n  File \\\"apps/frappe/frappe/database/database.py\\\", line 414, in get_value\\n    order_by, cache=cache, for_update=for_update)\\n  File \\\"apps/frappe/frappe/database/database.py\\\", line 458, in get_values\\n    out = self._get_values_from_table(fields, filters, doctype, as_dict, debug, order_by, update, for_update=for_update)\\n  File \\\"apps/frappe/frappe/database/database.py\\\", line 611, in _get_values_from_table\\n    values, as_dict=as_dict, debug=debug, update=update)\\n  File \\\"apps/frappe/frappe/database/database.py\\\", line 148, in sql\\n    self._cursor.execute(query, values)\\n  File \\\"env/lib/python3.7/site-packages/pymysql/cursors.py\\\", line 148, in execute\\n    result = self._query(query)\\n  File \\\"env/lib/python3.7/site-packages/pymysql/cursors.py\\\", line 310, in _query\\n    conn.query(q)\\n  File \\\"env/lib/python3.7/site-packages/pymysql/connections.py\\\", line 548, in query\\n    self._affected_rows = self._read_query_result(unbuffered=unbuffered)\\n  File \\\"env/lib/python3.7/site-packages/pymysql/connections.py\\\", line 775, in _read_query_result\\n    result.read()\\n  File \\\"env/lib/python3.7/site-packages/pymysql/connections.py\\\", line 1156, in read\\n    first_packet = self.connection._read_packet()\\n  File \\\"env/lib/python3.7/site-packages/pymysql/connections.py\\\", line 725, in _read_packet\\n    packet.raise_for_error()\\n  File \\\"env/lib/python3.7/site-packages/pymysql/protocol.py\\\", line 221, in raise_for_error\\n    err.raise_mysql_exception(self._data)\\n  File \\\"env/lib/python3.7/site-packages/pymysql/err.py\\\", line 143, in raise_mysql_exception\\n    raise errorclass(errno, errval)\\npymysql.err.OperationalError: (1054, \\\"Unknown column 'woocommerce_email' in 'where clause'\\\")\\n\"]"}



Any idea what’s causing this?

im giving this a try with Woocommerce integration and getting the same symptoms.

for anyone else having this error,
TLDR; When saving the webhook on woocommerce is returns 500
This is because on the frappe end.It fails the verfication.

Frappe woocommerce endpoint has a method verify_request which compares base64 encode of the secret in woocommerce settings with a header X-Wc-Webhook-Signature which os supposed to be in the headers sent with the request.

Woocommerce doesnt send this header when creating and saving webhooks. So the verification always fails and returns a 500

So you can ignore error and still go ahead to use it the webhook, it sends this header for actual events