Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Gadget throws javascript exception 'a is undefined' when deploying on production JIRA

Arthur
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2013

----UPDATE 19.07.2013----

Hey Guys! I found out that the jquery.dataTables plugin I'm using is causing the error. When I comment-out the dataTable call, the gadget runs fine.

Here is the resources definition in atlassian-plugin.xml

<resource type="download" name="datatable/images/back_disabled.png" location="/datatable/images/back_disabled.png"/>
        <resource type="download" name="datatable/images/back_enabled_hover.png" location="/datatable/images/back_enabled_hover.png"/>
        <resource type="download" name="datatable/images/back_enabled.png" location="/datatable/images/back_enabled.png"/>
        <resource type="download" name="datatable/images/forward_disabled.png" location="/datatable/images/forward_disabled.png"/>
        <resource type="download" name="datatable/images/forward_enabled_hover.png" location="/datatable/images/forward_enabled_hover.png"/>
        <resource type="download" name="datatable/images/forward_enabled.png" location="/datatable/images/forward_enabled.png"/>
        <resource type="download" name="datatable/images/sort_asc_disabled.png" location="/datatable/images/sort_asc_disabled.png"/>
        <resource type="download" name="datatable/images/sort_asc.png" location="/datatable/images/sort_asc.png"/>
        <resource type="download" name="datatable/images/sort_both.png" location="/datatable/images/sort_both.png"/>
        <resource type="download" name="datatable/images/sort_desc_disabled.png" location="/datatable/images/sort_desc_disabled.png"/>
        <resource type="download" name="datatable/images/sort_desc.png" location="/datatable/images/sort_desc.png"/>
        <resource type="download" name="datatable/css/jquery.dataTables.css" location="/datatable/css/jquery.dataTables.css"/>
        <resource type="download" name="datatable/css/jquery.dataTables_themeroller.css" location="/datatable/css/jquery.dataTables_themeroller.css"/>
        <resource type="download" name="datatable/js/jquery.dataTables.min.js" location="/datatable/js/jquery.dataTables.min.js"/>

Somebody knows why dataTables makes this conflict with the jira javascripts??

=== older post ====

I'm developing a gadget with atlassian development kit with a local jira instance, (v5.1.8#787-sha1:823790c).

In my local running jira, my gadget is running fine, but when I deploy it to our production jira(v5.2.11#854-sha1:ef00d61), I get the following javascript error messages:

In Chrome: "Uncaught TypeError: Cannot read property 'length' of undefined" in file "com.atlassian.auiplugin:jquery-lib.js:2"

In Firefox: "TypeError: a is undefined

..."resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b..." also in file "com.atlassian.auiplugin:jquery-lib.js:2"

The result is, that in the production jira dashboard, my gadget is completely empty. When I look into the firebug console, I see that my rest calls returns the correct data.

So the error occurs when I call the jquery functions to init the datatable.

I used a File diff tool and found only one big difference: In the production gadget.xml, my js-resources were packed into one file, called "[...]/download/batch/mygadget:resources/mygadget:resources.js"

But in my local jira the resources were loaded separately.

Thanks in advance

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Arthur
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2013

It is a specific problem with jira 5.2.x I think, because it works with jira 5.1x.

The only solution is to include your own jquery-version(I used 1.8.3) and call the dataTable() function not with AJS.$ but with the jQuery object.

jibranbala February 10, 2016

I am using DataTables with JIRA 7. Wen I call Datables() on jQuery, the tables gets created but after that error is shown (minified version: a is undefined).

0 votes
OsmanA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2013

Are there any clashing id's in the combined file?

Arthur
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2013

How could I check that?

Because all is minified, and the bundled script is VERY LARGE, I'm a bit confused how to check for clashing id's.

Here is the original bundled javascript source: http://pastebin.com/m1LPJbqe

Arthur
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2013

dataTable makes this conflict, but why....

TAGS
AUG Leaders

Atlassian Community Events