Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: Can't find variable: dataKeys

Tags:

javascript

I'm working on an existing web application. I'm receiving some front-end errors that are fired for just one known user. The log says:

[2014-05-19 18:40:05] frontend.ERROR: ReferenceError: Can't find variable: dataKeys {"file":"undefined","line":"13","browser":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.76.4 (KHTML, like Gecko) Version/7.0.4 Safari/537.76.4","page":"aPageFromTheSite"} []

This error is fired from different pages on the site.

I've tried to search the variable dataKeys:

grep -r "dataKeys" ./

but no results are found. I wonder where could it come from, since I'm not able to reproduce the error. I've also "googled", but no relevant results are found. Any idea of what it can be due to?

like image 876
Manolo Avatar asked May 30 '14 11:05

Manolo


1 Answers

This can come from a third party script or because of a Javascript function trying to reference a variable before the page is properly loaded.

Hard to tell without looking at the code but since you searched the server for the string I would guess it's a referenced script.

Could be jquery, too if it's not present on the server and imported from an external source.

When a script on the page references a jquery variable before jquery is loaded, such errors can occur. That's why one should always use $(document).ready(function() to prevent such errors.

like image 144
Broco Avatar answered Sep 18 '22 13:09

Broco