Getting ReferenceError AP is not defined

javascript
api
iframe
jira-cloud

#1

I noticed that every day we get a bulk of errors coming from our cloud app. We show a panel on issue view and sometimes AP is not available resulting with ReferenceError: AP is not defined.

So far I know:

  • it happens on old and new issue view experience
  • position of the panel is irrelevant (we show it on the left and right side)
  • majority of problems are on Chrome, some on Firefox

We load host’s all.js first, later our code (we use webpack) all tags located at the end of the body:

<script src="{{hostScriptUrl}}" type="text/javascript"></script>
<script src="{{{furl '/js/vendors.js'}}}" type="text/javascript"></script>
<script type="text/javascript" src="{{{furl '/js/issue-panel.js'}}}"></script>

So AP should already be there.

I found some previous reports of this problem but for Confluence:


https://ecosystem.atlassian.net/projects/CE/issues/CE-606?filter=allissues

Any hints are welcome as I’m not sure how to investigate that further.


#3

If this error is intermittent, the only thing that comes to mind is if an exception occurs during the elaboration of all.js, perhaps due to it processing the query/context parameters passed in the URL? Depending on when/where the exception occurs, it may prevent AP being set.


#4

Thanks, that inspired me to add some code that will save errors from the beginning and report them back to sentry once it’s loaded, will see if that gives more details.


#5

We have the same issue in Confluence! The xdm_e is always set to https://confluence-prod-us-9-2.prod.atl-paas.net in this case, which seems odd.

Maybe someone from Atlassian knows where this URL is coming from? The issue started appearing on June 15th. The customer key in the JWT is set to all kinds of different values, the only thing in common is the unusual xdm_e URL.


#6

Probably related to Using AP.request to fetch content from the Confluence host has recently stopped working?