gzwine opened a new issue, #5573:
URL: https://github.com/apache/incubator-devlake/issues/5573

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   If there is no  “Bug Status“ data, an error will be reported, and the 
pipeline exit:
   
   > time="2023-06-25 02:53:49" level=error msg=" [pipeline service] [pipeline 
#104] [task #467] subtask extractBugStatus ended unexpectedly
    Wraps: (2) error calling plugin Extract implementation
    Wraps: (3) json: cannot unmarshal array into Go struct field .Data of type 
map[string]string
    Wraps: (4) json: cannot unmarshal array into Go struct field .Data of type 
map[string]string
    Error types: (1) *hintdetail.withDetail (2) *hintdetail.withDetail (3) 
*hintdetail.withDetail (4) *json.UnmarshalTypeError"
   
   
   ### What do you expect to happen
   
   no errors reported
   
   ### How to reproduce
   
   1. choose one tapd workspace to sync, that workspace no Bug Status. 
(https://api.tapd.cn/workflows/status_map this api return no data)
   2. run sync task.
   
   ### Anything else
   
   ./backend/plugins/tapd/tasks/bug_status_extractor.go
   
   ```go
   func ExtractBugStatus(taskCtx plugin.SubTaskContext) errors.Error {
        rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, 
RAW_BUG_STATUS_TABLE)
        extractor, err := api.NewApiExtractor(api.ApiExtractorArgs{
                RawDataSubTaskArgs: *rawDataSubTaskArgs,
                Extract: func(row *api.RawData) ([]interface{}, errors.Error) {
                           if string(row.Data) == "[]" { // problem in this line
                                return nil, nil
                        }
                        var statusRes struct {
                                Data map[string]string
                        }
                        err := errors.Convert(json.Unmarshal(row.Data, 
&statusRes))
                        if err != nil {
                                return nil, err
                        }
                        results := make([]interface{}, 0)
                        for k, v := range statusRes.Data {
                                toolL := &models.TapdBugStatus{
                                        ConnectionId: data.Options.ConnectionId,
                                        WorkspaceId:  data.Options.WorkspaceId,
                                        EnglishName:  k,
                                        ChineseName:  v,
                                        IsLastStep:   false,
                                }
                                results = append(results, toolL)
                        }
   
                        return results, nil
                },
        })
   
        if err != nil {
                return err
        }
   
        return extractor.Execute()
   }
   
   ``` 
   
   ### Version
   
   v0.17.0-beta11
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to