Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

AP is not defined

Deleted user Mar 07, 2017

In an Atlassian connect plugin, we've this code

$(document).ready(function() {
    AP.require('request', function(request) {

which works fine, but sometimes and randomly we receive the error message in the object

AP is not defined

And this is not related to a specific browser or OS

Any idea of why this happens?

Any suggestion on what to investigate?




That's the head section of my web panel

<html lang="en">
        <script src="//"></script>
        <script src="//"></script>
        <link rel="stylesheet" href="//" media="all">
        <link rel="stylesheet" href="mycustom.css">
        <script src="mycustom.js"></script>

and that's the last part of the body

<!-- Stop the loading addon message -->
    <script id="connect-loader" data-options="sizeToParent:true;">
        (function() {
            var getUrlParam = function(param) {
                var codedParam = (new RegExp(param + '=([^&]*)')).exec([1];
                return decodeURIComponent(codedParam);

            var baseUrl = getUrlParam('xdm_e') + getUrlParam('cp');
            var options = document.getElementById('connect-loader').getAttribute('data-options');
            var script = document.createElement("script");
            script.src = baseUrl + '/atlassian-connect/all.js';

            if (options) {
                script.setAttribute('data-options', options);


as described in the Atlassian dev documentation

3 answers

AP is defined in "integration bridge" all.js loaded from your host JIRA:


I guess that all.js is not loaded (which should not happen) or maybe your load your custom JS file before all.js.

Deleted user Mar 08, 2017

all.js is loaded before my custom JS because the code works fine, 

and my JS is loaded at last in my web panel

but it seems that sometime (and I don't know when and why) 

AP is not available (i.e. all.js is not loaded?)

Like # people like this

Make sure you do no have async attribute in script tags.

Thanks @Volodymyr Krupach !

It was strange that AP works randomly, but removing async helped.

Hi @Volodymyr Krupach  ,

I try to add all.js to my plugin but I got this err: http://localhost:2990/jira/atlassian-connect/all.js net::ERR_ABORTED 404


It couldn't load

Do you have any idea about this?


Hi @Dang Thi Thuy Tien ,

Jira Cloud should NOT be loaded from localhost. You need to get development instance hosted by Atlassian. Here is a good tutorial:

Hi @Volodymyr Krupach 
Thank you so much, 

I find some link 

<script src="" type="text/javascript"></script>

But  It has another error  :


Cannot read property 'request' of undefined

Thank you

all.js must be loaded from the hosting Jira. It's a bridge between hosting Jira and your app and it will not work when loaded from outside.

0 votes

Uncaught (in promise) TypeError: AP.request is not a function

I'm getting this error and don't know what's wrong, the only difference is I'm running the app in localhost.

I am running into this exact same issue with loading all.js from our JIRA instance. The script loader is absolutely doing the right thing, we've used it forever for our Confluence add-on and I've verified that it's present and loaded in the DOM. It's all.js that has an issue when it tries to execute.

I'm getting an Uncaught TypeError: Object.defineProperty called on a non-object, and AP fails to be created or made available to our add-in

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

373 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you