How to identify which plugin causes error

AI-generated summary

In a support thread titled “How to identify which plugin causes error,” tophee reports a recurring JavaScript error: TypeError: Cannot read property 'on' of undefined, originating from a minified plugin-third-party-*.js file. zogstrip suggests disabling plugins one by one to isolate the culprit, but tophee notes the error is intermittent, making this method unreliable. zogstrip adds that studying plugin source code is the only alternative. tophee struggles to locate the file in a Docker setup. JagWaugh asks for details from the error log’s info, backtrace, and env tabs, which tophee provides — confirming the error’s origin and environment. JagWaugh then suggests entering the Docker container and running cat plugin-third-party-*.js to inspect the file directly, noting that plugin names are often visible near the top. tophee confirms this method worked elegantly and quickly, identifying the national-flags plugin as the source, and plans to disable it immediately.

My error log is repeatedly showing this error:

TypeError: Cannot read property ‘on’ of undefined
at https://forum.example.com/assets/plugin-third-party-79ea46991b76279d783d995c65d62ffb2f95ae7e68e0c79644ba01b7649d2a95.js:1:14095
at https://forum.example.com/assets/plugin-third-party-79ea46991b76279d783d995c65d62ffb2f95ae7e68e0c79644ba01b7649d2a95.js:1:14175

How do I know which plugin this javascript file is from?

By disabling them all and then enabling them one by one.

Hm, the problem is that the error seems to occur intermittently so that if it doesn’t occur, I can never be sure whether it’s because the plugin is disabled or because it decided to keep quiet for a while. Any other way?

Apart from studying the source code of each plugins, I can’t think of any other way.

I have tried to find that js file to see if there’s any hint in it, but I have no idea where to find it (I’m using docker).

What do the info, backtrace, and env tabs of /logs contain for that error?

Info (domain replaced):

Uncaught TypeError: Cannot read property 'on' of undefined
Url: https://forum.example.com/assets/plugin-third-party-865e853871f20eeae50c3bede19ef7d8bd5352766ee238799cb2bb94caaecd68.js
Line: 1
Column: 14095
Window Location: https://forum.example.com/latest

The OP was from b.acktrace

env (edited):

hostname	***
process_id	[143, 135, 150]
application_version	f918951d42234790938da442a768c2bf80f87069
HTTP_HOST	forum.example.com
REQUEST_URI	/logs/report_js_error
REQUEST_METHOD	POST
HTTP_USER_AGENT	[Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36]
HTTP_ACCEPT	*/*
HTTP_REFERER	https://forum.example.com/
HTTP_X_FORWARDED_FOR	[83.xx.xx.xx, unix:, 130.xxx.xx.xx, unix:]
HTTP_X_REAL_IP	unix:
params	
message	Uncaught TypeError: Cannot read property 'on' of undefined Url: https://forum.example.com/assets/plug
url	https://forum.example.com/assets/plugin-third-party-865e853871f20eeae50c3bede19ef7d8bd5352766ee238799
line	1
column	14095
window_location	https://forum.example.com/
stacktrace	TypeError: Cannot read property 'on' of undefined at https://forum.example.com/assets/plugin-thir

Hmn, I’m no smarter now than I was 29 minutes ago. (same goes for hours, days and months).

What plugins have your got installed?

Try
./launcher enter app
cd public/assets
cat plugin-third-party-865e853871f20eeae50c3bede19ef7d8bd5352766ee238799cb2bb94caaecd68.js
(actually “cat plugin-third-party-865e” then tab to auto complete, the first hit will probably be the .js file)

You will find the name of the plugin mentioned in the .js file if you scroll up.

(There are more elegant ways to do this.)

This, I thought was quite elegant and fast. I found the perpetrator it’s the national-flags plugin and I will disable it right away. Thank you so much!