Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialization with jQuery -> Cannot read property 'jquery' of undefined #145

Closed
Piioo opened this issue Jun 16, 2015 · 8 comments
Closed

Comments

@Piioo
Copy link

Piioo commented Jun 16, 2015

When I add this to my initialization:

var airbrake = new airbrakeJs.Client({projectId: 1, projectKey: 'abc'});
if (window.jQuery) {
  airbrakeJs.instrumentation.jquery(airbrake, jQuery);
}

Cannot read property 'jquery' of undefined

airbrakeJs
-> Object {}

What I doing wrong?

@vmihailenco
Copy link
Contributor

Hi,

Most likely you did not include instrumentation/jquery.js script. For example

@Piioo
Copy link
Author

Piioo commented Jun 18, 2015

Thx you right. I have installed airbrake-js with bower and Bowerfile in Ruby on Rails and sprocket was not known instrumentation/jquery.js.

@ericjames
Copy link

I am having this problem too. Is instrumentation a modified version of jquery specific to airbrake? how come when I try to load jquery 2.1.4, it won't work. @vmihailenco

@vmihailenco
Copy link
Contributor

airbrake-js jQuery instrumentation just adds some hooks to standard jQuery version - https://raw.githubusercontent.com/airbrake/airbrake-js/master/src/instrumentation/jquery.coffee. It should work with 2.1.4, but I did not test it.

@ericjames
Copy link

Okay that's what I was getting at, it sounds like this file is adding hooks, but it doesn't appear to actually just be a plain jQuery library.

I was trying to load airbrake and a standard jQuery library, without this instrumentation file.

I would recommend renaming the file jquery-hooks or something so people understand what this file is doing (naming it jquery.min.js implies it is a standard library file)

@kiflay
Copy link

kiflay commented Mar 13, 2017

I am getting the same error, 'Uncaught TypeError: Cannot read property 'jquery' of undefined'
I have checked if jQuery is not defined, it returns false.
--> typeof jQuery == 'undefined'
--> false
using jQuery returns an object`` instead the 'div element'
--> jQuery('#featured-tags__menu__tag1')
--->Object {ready: function}

@vmihailenco
Copy link
Contributor

Then just don't include instrumentation/jquery.js file...

@kiflay
Copy link

kiflay commented Mar 13, 2017

@vmihailenco I don't have instrumentation/jquery.js on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants