diff --git a/backend/plugins/bitbucket/api/remote_api.go b/backend/plugins/bitbucket/api/remote_api.go index 2da3f7ab626..211901ec3c6 100644 --- a/backend/plugins/bitbucket/api/remote_api.go +++ b/backend/plugins/bitbucket/api/remote_api.go @@ -80,6 +80,15 @@ func listBitbucketWorkspaces( if err != nil { return } + if res.StatusCode > 299 { + body, e := io.ReadAll(res.Body) + if e != nil { + err = errors.BadInput.Wrap(e, "failed to read response body") + return + } + err = errors.HttpStatus(res.StatusCode).New(string(body)) + return + } resBody := &models.WorkspaceResponse{} err = api.UnmarshalResponse(res, resBody) diff --git a/config-ui/src/routes/onboard/components/card.tsx b/config-ui/src/routes/onboard/components/card.tsx index d2250573da3..2d45ffe3eab 100644 --- a/config-ui/src/routes/onboard/components/card.tsx +++ b/config-ui/src/routes/onboard/components/card.tsx @@ -49,11 +49,11 @@ export const OnboardCard = ({ style }: Props) => { const tasksRes = useAutoRefresh( async () => { - if ((data && data.done) || !record) { + if ((data && data.done) || !record || !record.pipelineId) { return; } - return await API.pipeline.subTasks(record?.pipelineId as string); + return await API.pipeline.subTasks(record.pipelineId as string); }, [record], { diff --git a/config-ui/src/routes/onboard/step-4.tsx b/config-ui/src/routes/onboard/step-4.tsx index 569ed0f3da6..eb6eb44ebd4 100644 --- a/config-ui/src/routes/onboard/step-4.tsx +++ b/config-ui/src/routes/onboard/step-4.tsx @@ -112,7 +112,10 @@ export const Step4 = () => { const { data } = useAutoRefresh( async () => { - return await API.pipeline.subTasks(record?.pipelineId as string); + if (!record?.pipelineId) { + return; + } + return await API.pipeline.subTasks(record.pipelineId as string); }, [record], {