Error when creating Jira gadget in 7.x "Uncaught TypeError: Cannot read property 'getViewportDimensions' of undefined"

Hi I’ve been trying to get a Jira gadget working using a rest resource by following this tutorial:

I’ve managed to create the module and add the gadget to a dashboard. However, when I load the dashboard it appears as blank and when I inspect the dashboard element the console in chrome outputs the error:

Uncaught TypeError: Cannot read property 'getViewportDimensions' of undefined
    at HTMLDocument.showLoading (com.atlassian.gadgets.publisher:ajs-gadgets.js:formatted:540)
    at HTMLDocument.<anonymous> (com.atlassian.gadgets.publisher:ajs-gadgets.js:formatted:750)
    at HTMLDocument.dispatch (com.atlassian.plugins.jquery:jquery.js:formatted:1814)
    at HTMLDocument.h (com.atlassian.plugins.jquery:jquery.js:formatted:1619)
    at Object.trigger (com.atlassian.plugins.jquery:jquery.js:formatted:1745)
    at Object.trigger (com.atlassian.plugins.jquery:jquery.js:formatted:1762)
    at Function.jQuery.ajax (com.atlassian.gadgets.publisher:ajax.js:24)
    at Object.<anonymous> (com.atlassian.gadgets.publisher:ajs-gadgets.js:formatted:66)
    at Function.each (com.atlassian.plugins.jquery:jquery.js:formatted:481)
    at init.each (com.atlassian.plugins.jquery:jquery.js:formatted:298)

I’ve tried searching around for a solution to this problem but it doesn’t seem anyone has had a similar issue. From what I can tell, somewhere within the AJS gadget code, it tries to call a function on a null object but I can’t seem to see where that null object is.

Here is my content element from the gadget.xml if that helps as well:

        <script type="text/javascript">
            (function () {
                var gadget = AJS.Gadget({
                    baseUrl: "__ATLASSIAN_BASE_URL__",
                    useOauth: "/rest/gadget/1.0/currentUser",
                    view: {
                        template: function(args) {
                            var gadget = this;

                            var projectList = AJS.$("<ul/>");

                            AJS.$(args.projectData).each(function() {
                                            target: "_parent",
                                            title: gadgets.util.escapeString(this.key),
                                            href: "__ATLASSIAN_BASE_URL__" + "/browse/" + this.key


                        args: [{
                            key: "projectData",
                            ajaxOptions: function() {
                                return {
                                    url: "/rest/issuehierarchy/1.0/issuehierarchy?jql="

Hi, @neil.sonnenberg.

It seems the tutorial you’re referencing is for older Jira versions (4.4.x and 5.0). You can try the following from scratch

  1. Create a new Jira Server app byatlas-create-jira-plugin
  2. cd to the newly created app
  3. Create a gadget via atlas-create-jira-plugin-module then select Gadget Plugin Module

These steps should generate a starting point for you. There is also a REST plugin module just in case.

This project seems to be updated to be Jira 7.x compatible but I haven’t tried running this one yet.

Hope this helps.


I will take a look at the project thank you. However, this project was created using the steps you’ve mentioned. It still refuses to work.

Thank you,

The problem turned out to be in my gadget.xml in terms of what required features I needed.

I didn’t check to see but I assume I was missing <Require feature="dynamic-height"/> which was what gave me the error.

It has been solved now thanks.