Missing functions on AP object

I’m running into issues with Atlassian Connect, using the javascript API.

I have a descriptor with a simple webitem

{
  "name": "Create Branch",
  "description": "Adds a button to issue tools to create a branch",
  "key": "com.example.create-branch",
  "baseUrl": "https://6026-86-88-172-152.ngrok.io",
  "vendor": {
      "name": "Example",
      "url": "https://example.com"
  },
  "authentication": {
      "type": "none"
  },
  "scopes": [ "READ" ],
  "apiVersion": 1,
  "modules": {
    "webItems": [
      {
          "key": "create-branch-tools-item",
          "location": "operations-operations",
          "weight": 10,
          "name": {
              "value": "Create branch"
          },
          "url": "/create-branch.html?issueKey={issue.key}&issueTypeId={issuetype.id}"
      }
    ]
  }
}

This causes a click of the Create branch button to open ‘create-branch.html’, so far so good. It opens a the page as expected.

My page loads using the following contents.

<!DOCTYPE html>
<html lang="en">

<head>
  <!--<link rel="stylesheet" href="https://unpkg.com/@atlaskit/css-reset@2.0.0/dist/bundle.css" media="all">-->
  <script src="https://connect-cdn.atl-paas.net/all.js"></script>
</head>

<body>
  <script>
    window.onload = function () {
      debugger;
    }
  </script>
</body>

</html>

It breaks on debugger, so I can inspect my scope. Now when I look at window.AP, which supposedly comes from https://connect-cdn.atl-paas.net/all.js, I would expect there to be functions like ‘request’, to get more info from my instance. But my AP object is very limited, when doing examples like AP.request(etc…) I always get not found.

Here is an example of what my AP object looks like:

What am I doing wrong here?

Your not doing anything wrong, except that Bitbucket is not using the all.js from the CDN. You need to use

<script type="application/javascript" src="https://bitbucket.org/atlassian-connect/all.js"></script>

which again, is not your fault, but the somewhat confusing documentation that Atlassian does not care to update because (unofficially) Connect is a dying framework.

I went and checked and the Bitbucket Cloud documentation does not state to use the CDN. About the Javascript API

Are you seeing something different?

Sorry for not mentioning, the plugin is for JIRA Cloud not for BitBucket.

I was following this:
About the JavaScript API (atlassian.com)
and same here: Getting started with Connect (atlassian.com) where they are using <script src="https://connect-cdn.atl-paas.net/all.js" async></script>

What do you get if you set the Authentication to “JWT” instead of “none”? I suspect you aren’t given the functions that require JWT if you don’t have the right auth declared.