You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(jira): align setup guide with implemented behavior (#552) (#554)
Fixes from a live setup walkthrough on a dev stack:
- Prerequisites: state the stack must include the Jira integration
(#302) — pre-#302 stacks have no Jira resources and need a redeploy
- Step 2: note on the stalled 'Waiting for browser callback' state and
that re-running setup is safe/idempotent (+ troubleshooting entry)
- Step 4: point at setup's ready-to-paste Next-steps map command; add
cloudId recovery via _edge/tenant_info or the workspace registry
- Step 5: document the interim manual user-mapping put-item with the
exact row shape jira-link.ts writes, how to find the Atlassian
accountId and Cognito sub, and cross-link #553 (invite-user); call
out the dead-end 'run jira link' comment for unlinked users
- Troubleshooting: new '401 calling the API right after setup' entry —
~1h token life, Lambda-side refresh on next webhook, manual-refresh
hazards (refresh-token rotation, webhook_signing_secret preservation)
- Diagram: POST /jira/webhook → POST /v1/jira/webhook (stage prefix)
Starlight mirror regenerated via mise //docs:sync.
Copy file name to clipboardExpand all lines: docs/guides/JIRA_SETUP_GUIDE.md
+37-4Lines changed: 37 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Set up the ABCA Jira Cloud integration so that adding a label to a Jira issue tr
4
4
5
5
## Prerequisites
6
6
7
-
- ABCA CDK stack deployed (see [Developer guide](./DEVELOPER_GUIDE.md))
7
+
- ABCA CDK stack deployed **at a version that includes the Jira integration** ([#302](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/pull/302), merged 2026-06-17) — a stack deployed before that has no Jira resources and needs a sync + redeploy first (see [Developer guide](./DEVELOPER_GUIDE.md))
8
8
- A Cognito user account configured (see [User guide](./USER_GUIDE.md))
9
9
- A Jira Cloud site where you have **admin** access (to create the OAuth app and the webhook)
10
10
- The `bgagent` CLI installed and logged in (`bgagent configure` + `bgagent login`)
@@ -21,7 +21,7 @@ Inbound (Jira → ABCA):
21
21
22
22
```
23
23
Jira Cloud webhook
24
-
→ POST /jira/webhook (API GW, no Cognito, HMAC-verified)
24
+
→ POST /v1/jira/webhook (API GW, no Cognito, HMAC-verified)
→ JiraWebhookProcessorFn (resolve tenant OAuth, look up project→repo,
27
27
build task, call createTaskCore)
@@ -88,6 +88,8 @@ This runs the OAuth 3LO dance:
88
88
4. If your account can access multiple Atlassian sites, the CLI lists them and asks you to pick one. It records the selected site's `cloud_id` and `site_url`.
89
89
5. Stores the OAuth token bundle in `bgagent-jira-oauth-<cloudId>` and records the tenant in the workspace registry.
90
90
91
+
> **If `setup` hangs at "Waiting for browser callback…"** the consent redirect never reached the CLI's localhost listener. Usual causes: the consent tab was completed in a *different* browser/profile than the one `setup` opened, the tab was closed before clicking Authorize, or something else is bound to port 8080. Ctrl-C and re-run `bgagent jira setup` — re-running is safe and idempotent (it re-mints the token bundle and re-registers the tenant; nothing is half-written by an aborted attempt).
92
+
91
93
### 3. Configure the Jira webhook
92
94
93
95
`setup` then prompts for a **webhook signing secret**. Unlike Linear, Atlassian does **not** auto-generate one — the operator chooses it at webhook-create time. In a second terminal, open **Jira → Settings → System → Webhooks → Create a Webhook** and enter:
@@ -104,7 +106,7 @@ Paste that same secret value back at the `Webhook signing secret:` prompt. ABCA
-`<cloud-id>` — the tenant UUID `setup` printed (`cloud_id: …`)
109
+
-`<cloud-id>` — the tenant UUID.`setup`'s final **Next steps** block prints this exact `map` command with the cloudId pre-filled — paste it and swap in your project key and repo. If that terminal output is gone, recover the cloudId from `https://<your-site>.atlassian.net/_edge/tenant_info` (returns it as JSON) or from the workspace-registry table — it is *not* shown anywhere in the Jira UI
108
110
-`<PROJECT-KEY>` — the Jira project key, e.g. `ENG` (uppercase, starts with a letter)
109
111
-`--repo owner/repo` — the GitHub repository tasks from this project route to
The CLI shows the Jira identity (name + email) and the tenant, and asks for confirmation **before** writing the mapping row — so a mis-issued code is caught before it binds.
123
125
124
-
> The `invite-user` issuing command is not yet implemented. Until it lands, an admin can populate the user-mapping row manually (`accountId` → platform user id) for the tenant.
126
+
> The `invite-user` issuing command is not yet implemented (tracked in [#553](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/issues/553)). Until it lands, an admin can write the user-mapping row directly. Note that until the row exists, a labeled issue from the unlinked user produces no task — the processor comments "Run `bgagent jira link <code>`" on the issue, but no code can be issued yet.
127
+
128
+
**Interim manual linking (admin IAM).** Write an `active` row to the user-mapping table (stack output `JiraUserMappingTableName`), keyed exactly as `jira-link.ts` would write it:
129
+
130
+
```bash
131
+
aws dynamodb put-item \
132
+
--table-name <JiraUserMappingTableName> \
133
+
--item '{
134
+
"jira_identity": {"S": "<cloudId>#<accountId>"},
135
+
"platform_user_id": {"S": "<cognito-sub>"},
136
+
"jira_cloud_id": {"S": "<cloudId>"},
137
+
"jira_account_id": {"S": "<accountId>"},
138
+
"linked_at": {"S": "<ISO-8601 timestamp>"},
139
+
"status": {"S": "active"},
140
+
"link_method": {"S": "manual"}
141
+
}'
142
+
```
143
+
144
+
Where to find the two identity values:
145
+
146
+
-**Atlassian `accountId`** — open your Jira profile (avatar → Profile); the URL ends `/people/<accountId>`. Or call `GET https://api.atlassian.com/ex/jira/<cloudId>/rest/api/3/myself` with the stored token.
147
+
-**Cognito sub (platform user id)** — `aws cognito-idp admin-get-user --user-pool-id <pool> --username <email> --query 'UserAttributes[?Name==`sub`].Value' --output text`.
--query SecretString --output text | jq .webhook_signing_secret
174
197
```
175
198
199
+
### `setup` hangs at "Waiting for browser callback…"
200
+
201
+
The consent redirect never reached the CLI's localhost listener — see the note under [Step 2](#2-authorize-the-app-on-the-tenant). Ctrl-C and re-run `bgagent jira setup`; re-running is safe.
202
+
203
+
### 401 when calling the Jira API directly after setup
204
+
205
+
Expected, not a broken install. The stored access token lives ~1 hour and is only refreshed by the **trusted Lambda paths** when they next run — i.e. on the next webhook delivery (see [Limits and quotas](#limits-and-quotas)). If you fetch the token from Secrets Manager right after `setup` to verify it and get a 401, the integration is still fine: add the trigger label to an issue and the processor will refresh the bundle before using it.
206
+
207
+
**Do not refresh the token manually.** Atlassian rotates the `refresh_token` on every use, and the rotated bundle must be written back to Secrets Manager *preserving every other field* — in particular `webhook_signing_secret`. A manual refresh that drops a field or loses the rotated refresh token bricks the tenant install (the only recovery is re-running `bgagent jira setup`). If you need a live token for debugging, trigger a label event and read the bundle the Lambda just wrote.
Copy file name to clipboardExpand all lines: docs/src/content/docs/using/Jira-setup-guide.md
+37-4Lines changed: 37 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Set up the ABCA Jira Cloud integration so that adding a label to a Jira issue tr
8
8
9
9
## Prerequisites
10
10
11
-
- ABCA CDK stack deployed (see [Developer guide](/sample-autonomous-cloud-coding-agents/developer-guide/introduction))
11
+
- ABCA CDK stack deployed **at a version that includes the Jira integration** ([#302](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/pull/302), merged 2026-06-17) — a stack deployed before that has no Jira resources and needs a sync + redeploy first (see [Developer guide](/sample-autonomous-cloud-coding-agents/developer-guide/introduction))
12
12
- A Cognito user account configured (see [User guide](/sample-autonomous-cloud-coding-agents/using/overview))
13
13
- A Jira Cloud site where you have **admin** access (to create the OAuth app and the webhook)
14
14
- The `bgagent` CLI installed and logged in (`bgagent configure` + `bgagent login`)
@@ -25,7 +25,7 @@ Inbound (Jira → ABCA):
25
25
26
26
```
27
27
Jira Cloud webhook
28
-
→ POST /jira/webhook (API GW, no Cognito, HMAC-verified)
28
+
→ POST /v1/jira/webhook (API GW, no Cognito, HMAC-verified)
→ JiraWebhookProcessorFn (resolve tenant OAuth, look up project→repo,
31
31
build task, call createTaskCore)
@@ -92,6 +92,8 @@ This runs the OAuth 3LO dance:
92
92
4. If your account can access multiple Atlassian sites, the CLI lists them and asks you to pick one. It records the selected site's `cloud_id` and `site_url`.
93
93
5. Stores the OAuth token bundle in `bgagent-jira-oauth-<cloudId>` and records the tenant in the workspace registry.
94
94
95
+
> **If `setup` hangs at "Waiting for browser callback…"** the consent redirect never reached the CLI's localhost listener. Usual causes: the consent tab was completed in a *different* browser/profile than the one `setup` opened, the tab was closed before clicking Authorize, or something else is bound to port 8080. Ctrl-C and re-run `bgagent jira setup` — re-running is safe and idempotent (it re-mints the token bundle and re-registers the tenant; nothing is half-written by an aborted attempt).
96
+
95
97
### 3. Configure the Jira webhook
96
98
97
99
`setup` then prompts for a **webhook signing secret**. Unlike Linear, Atlassian does **not** auto-generate one — the operator chooses it at webhook-create time. In a second terminal, open **Jira → Settings → System → Webhooks → Create a Webhook** and enter:
@@ -108,7 +110,7 @@ Paste that same secret value back at the `Webhook signing secret:` prompt. ABCA
-`<cloud-id>` — the tenant UUID `setup` printed (`cloud_id: …`)
113
+
-`<cloud-id>` — the tenant UUID.`setup`'s final **Next steps** block prints this exact `map` command with the cloudId pre-filled — paste it and swap in your project key and repo. If that terminal output is gone, recover the cloudId from `https://<your-site>.atlassian.net/_edge/tenant_info` (returns it as JSON) or from the workspace-registry table — it is *not* shown anywhere in the Jira UI
112
114
-`<PROJECT-KEY>` — the Jira project key, e.g. `ENG` (uppercase, starts with a letter)
113
115
-`--repo owner/repo` — the GitHub repository tasks from this project route to
The CLI shows the Jira identity (name + email) and the tenant, and asks for confirmation **before** writing the mapping row — so a mis-issued code is caught before it binds.
127
129
128
-
> The `invite-user` issuing command is not yet implemented. Until it lands, an admin can populate the user-mapping row manually (`accountId` → platform user id) for the tenant.
130
+
> The `invite-user` issuing command is not yet implemented (tracked in [#553](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/issues/553)). Until it lands, an admin can write the user-mapping row directly. Note that until the row exists, a labeled issue from the unlinked user produces no task — the processor comments "Run `bgagent jira link <code>`" on the issue, but no code can be issued yet.
131
+
132
+
**Interim manual linking (admin IAM).** Write an `active` row to the user-mapping table (stack output `JiraUserMappingTableName`), keyed exactly as `jira-link.ts` would write it:
133
+
134
+
```bash
135
+
aws dynamodb put-item \
136
+
--table-name <JiraUserMappingTableName> \
137
+
--item '{
138
+
"jira_identity": {"S": "<cloudId>#<accountId>"},
139
+
"platform_user_id": {"S": "<cognito-sub>"},
140
+
"jira_cloud_id": {"S": "<cloudId>"},
141
+
"jira_account_id": {"S": "<accountId>"},
142
+
"linked_at": {"S": "<ISO-8601 timestamp>"},
143
+
"status": {"S": "active"},
144
+
"link_method": {"S": "manual"}
145
+
}'
146
+
```
147
+
148
+
Where to find the two identity values:
149
+
150
+
-**Atlassian `accountId`** — open your Jira profile (avatar → Profile); the URL ends `/people/<accountId>`. Or call `GET https://api.atlassian.com/ex/jira/<cloudId>/rest/api/3/myself` with the stored token.
151
+
-**Cognito sub (platform user id)** — `aws cognito-idp admin-get-user --user-pool-id <pool> --username <email> --query 'UserAttributes[?Name==`sub`].Value' --output text`.
--query SecretString --output text | jq .webhook_signing_secret
178
201
```
179
202
203
+
### `setup` hangs at "Waiting for browser callback…"
204
+
205
+
The consent redirect never reached the CLI's localhost listener — see the note under [Step 2](#2-authorize-the-app-on-the-tenant). Ctrl-C and re-run `bgagent jira setup`; re-running is safe.
206
+
207
+
### 401 when calling the Jira API directly after setup
208
+
209
+
Expected, not a broken install. The stored access token lives ~1 hour and is only refreshed by the **trusted Lambda paths** when they next run — i.e. on the next webhook delivery (see [Limits and quotas](#limits-and-quotas)). If you fetch the token from Secrets Manager right after `setup` to verify it and get a 401, the integration is still fine: add the trigger label to an issue and the processor will refresh the bundle before using it.
210
+
211
+
**Do not refresh the token manually.** Atlassian rotates the `refresh_token` on every use, and the rotated bundle must be written back to Secrets Manager *preserving every other field* — in particular `webhook_signing_secret`. A manual refresh that drops a field or loses the rotated refresh token bricks the tenant install (the only recovery is re-running `bgagent jira setup`). If you need a live token for debugging, trigger a label event and read the bundle the Lambda just wrote.
0 commit comments