New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bitbucket has started giving 400 Bad Request (but still succeeds) #1285
Comments
Hi @wizardishungry , did you find out the solution for this issue? I just stuck on the same error on my bitbucket pipeline. |
@pararang We're still seeing it as well; I haven't had time to dig into the code yet. |
I was seeing this as well. In my case, the issue was that bitbucket doesn't accept annotations without a message. My linter was not reporting a message, so I had to use Can we add a specific error when reviewdog cannot post an annotation because of a missing message? From bb docs (summary is the same thing as message): |
I managed to get the underlying error message from Bitbucket: {"key": "report-service.general.bad-request", "message": "The summary field cannot contain more than 450 characters.", "arguments": {}} Suggestions as to how to fix this right now (by reviewdog configuration) would be welcomed, but it would also be helpful to be able to see underlying error messages.
_, resp, err := c.cli.ReportsApi.
BulkCreateOrUpdateAnnotations(ctx, req.Owner, req.Repository, req.Commit, req.ReportID).
Body(c.helper.BuildAnnotations(req.Comments)).
Execute() It appears that this call returns the error in question and |
I patched the code to truncate annotation summaries to 450 characters and now bitbucket is giving me: {"key": "report-service.annotation.max-annotations", "message": "Too many annotations associated with report with ID /{58263add-5b41-51b5-ae37-e287ca31c86f}", "arguments": {}} diff --git a/service/bitbucket/cloud_api_helper.go b/service/bitbucket/cloud_api_helper.go
index 62d366f..c46c816 100644
--- a/service/bitbucket/cloud_api_helper.go
+++ b/service/bitbucket/cloud_api_helper.go
@@ -35,10 +35,17 @@ func (c *CloudAPIHelper) BuildAnnotations(comments []*reviewdog.Comment) []bbapi
}
func (c *CloudAPIHelper) buildAnnotation(comment *reviewdog.Comment) bbapi.ReportAnnotation {
+
+ const MAX_SUMMARY_LENGTH = 450
+
data := bbapi.NewReportAnnotation()
data.SetExternalId(externalIDFromDiagnostic(comment.Result.Diagnostic))
data.SetAnnotationType(annotationTypeCodeSmell)
- data.SetSummary(comment.Result.Diagnostic.GetMessage())
+ summary := comment.Result.Diagnostic.GetMessage()
+ if len(summary) > MAX_SUMMARY_LENGTH {
+ summary = summary[:MAX_SUMMARY_LENGTH]
+ }
+ data.SetSummary(summary)
data.SetDetails(fmt.Sprintf(`[%s] %s`, comment.ToolName, comment.Result.Diagnostic.GetMessage()))
data.SetLine(comment.Result.Diagnostic.GetLocation().GetRange().GetStart().GetLine())
data.SetPath(comment.Result.Diagnostic.GetLocation().GetPath()) I'm not convinced I'm exceeding the annotations limit (1000?) – something else may be at foot. |
https://developer.atlassian.com/server/bitbucket/how-tos/code-insights/
|
Lookin at the reviewdog docs - it looks like bitbucket only supports |
In a fairly new installation of v0.14.1 that was working for a few days, we have started seeing consistent errors from reviewdog (for several days), but the code insights are still updated in bitbucket.
The text was updated successfully, but these errors were encountered: