dosubot[bot] commented on issue #7540:
URL: 
https://github.com/apache/incubator-devlake/issues/7540#issuecomment-2137166968

   <!-- Answer -->
   The Jira plugin is likely failing with a 502 error on the "collectIssues" 
subtask due to an issue with the API request to Jira. A 502 error typically 
indicates a bad gateway, meaning the server received an invalid response from 
an inbound server.
   
   To resolve this issue, you can try the following steps:
   
   1. **Check the API Client Configuration**: Ensure that the `ApiClient` is 
correctly configured and that the Jira server is reachable.
   
   2. **Verify the JQL Query**: The JQL query used in the request might be 
causing issues. Ensure that the JQL query is correctly formed and does not 
result in a large dataset that could overwhelm the server.
   
   3. **Reduce Concurrency**: The current concurrency level is set to 10. 
Reducing the concurrency might help if the server is being overwhelmed by too 
many simultaneous requests.
   
   4. **Check the Response Parser**: Ensure that the response parser is 
correctly handling the responses from Jira.
   
   Here is the relevant code snippet for setting up the API collector and 
making the request:
   
   ```go
   err = apiCollector.InitCollector(api.ApiCollectorArgs{
       ApiClient: data.ApiClient,
       PageSize:  data.Options.PageSize,
       UrlTemplate: "agile/1.0/board/{{ .Params.BoardId }}/issue",
       Query: func(reqData *api.RequestData) (url.Values, errors.Error) {
           query := url.Values{}
           query.Set("jql", jql)
           query.Set("startAt", fmt.Sprintf("%v", reqData.Pager.Skip))
           query.Set("maxResults", fmt.Sprintf("%v", reqData.Pager.Size))
           query.Set("expand", "changelog")
           return query, nil
       },
       GetTotalPages: GetTotalPagesFromResponse,
       Concurrency:   10,
       ResponseParser: func(res *http.Response) ([]json.RawMessage, 
errors.Error) {
           var data struct {
               Issues []json.RawMessage `json:"issues"`
           }
           blob, err := io.ReadAll(res.Body)
           if err != nil {
               return nil, errors.Convert(err)
           }
           err = json.Unmarshal(blob, &data)
           if err != nil {
               return nil, errors.Convert(err)
           }
           return data.Issues, nil
       },
   })
   if err != nil {
       return err
   }
   return apiCollector.Execute()
   ```
   
   Consider reducing the `Concurrency` value and verifying the `jql` query to 
ensure it is not causing issues. If the problem persists, further investigation 
into the network and server configurations might be necessary 
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jira/tasks/issue_collector.go)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   <details>
   <summary>
   
   #### Details
   </summary>
   
   **About Dosu**
   This response is meant to be useful and save you time. It is **not meant to 
be a precise solution**, but rather a starting point for your own research.
   
   Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is 
irrelevant.
   </details>
   
   *To continue the conversation, mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to