Files
cve-dashboard/docs/bugs/jira-sync-cross-project-failure.md

43 lines
1.8 KiB
Markdown
Raw Normal View History

# [Bug]: Jira sync fails for tickets in projects other than STEAM
**Labels:** kind/bug, status/resolved
## Description
Syncing individual Jira tickets (or bulk "Sync All") fails with a 502 "Failed to fetch issue from Jira" error when the ticket belongs to a Jira project other than the configured `JIRA_PROJECT_KEY` (STEAM). For example, ticket `AA_ADTRAN-541` in the `AA_ADTRAN` project cannot be synced because the JQL query hardcodes `AND project = STEAM`, which excludes all cross-project tickets.
This affects both single-ticket sync and the "Sync All" bulk operation.
## Steps to Reproduce
1. Go to the Jira Tickets page
2. Add or have a ticket with a key from a non-STEAM project (e.g., `AA_ADTRAN-541`)
3. Click the sync button on that ticket (or click "Sync All")
4. See browser alert: "Failed to fetch issue from Jira."
5. Console shows: `POST /api/jira-tickets/:id/sync` returns 502 (Bad Gateway)
## Environment
- Browser: Chrome (any)
- Server: Node.js on 71.85.90.9:3001
- Jira: Charter Jira Data Center (on-prem)
## Root Cause
`backend/helpers/jiraApi.js` — both `getIssue()` and `searchIssuesByKeys()` constructed JQL with `AND project = ${JIRA_PROJECT_KEY}` (resolves to `AND project = STEAM`). Since Jira issue keys are globally unique (the project prefix is part of the key), this filter is redundant for key-based lookups and breaks any ticket not in the STEAM project.
## Fix
Removed the `AND project = ${JIRA_PROJECT_KEY}` clause from:
- `getIssue()` — now uses `key = "${issueKey}"` only
- `searchIssuesByKeys()` — now uses `key in (...) AND updated >= -72h` only
`JIRA_PROJECT_KEY` is still used for issue creation (where it belongs).
## Relevant Log Output
```
POST http://71.85.90.9:3001/api/jira-tickets/:id/sync 502 (Bad Gateway)
Response: { "error": "Failed to fetch issue from Jira.", "details": "Issue not found" }
```