Skip to content
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

SynchronizationException due to missing or null head_branch field in GitHub Actions JSON response during pipeline synchronization #157

Open
davidsouza-protex opened this issue May 6, 2024 · 0 comments

Comments

@davidsouza-protex
Copy link

Describe the bug
When synchronizing a GitHub Actions pipeline in the project, the synchronization process fails due to a DecodeException caused by a missing or null head_branch value in the JSON response. The synchronization attempt leads to a SynchronizationException.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Project Synchronization Page'.
  2. Click on 'Start Synchronization' for the GitHub Actions pipeline.
  3. Observe the error message in the logs indicating a DecodeException due to the missing head_branch field.

Expected behavior
The synchronization should complete successfully without any errors, fetching all relevant data from the GitHub Actions pipeline.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version: 125

Additional context
The synchronization error occurs specifically due to a missing head_branch field in the response data. This field is required but is currently null or missing in the GitHub API response, leading to a decoding failure when processing the pipeline runs.

INFO 2024-05-06 23:47:27.960 traceId: --- [pool-186-thread-1] m.p.r.a.SynchronizationApplicationService:Started synchronization for project [example-project-id]
INFO 2024-05-06 23:47:27.965 traceId: --- [pool-186-thread-1] m.p.d.r.ProjectRepository:Query result project ID [example-project-id] is [Project(id=example-project-id, name=example-project-name, synchronizationTimestamp=1714998475516)]
INFO 2024-05-06 23:47:27.968 traceId: --- [pool-186-thread-1] m.p.d.r.PipelineRepository:Query result size for pipeline with project ID [example-project-id] is [1]
INFO 2024-05-06 23:47:27.968 traceId: --- [pool-186-thread-1] m.p.r.a.SynchronizationApplicationService:Synchronizing [1] pipelines under project [example-project-id]
INFO 2024-05-06 23:47:27.968 traceId: --- [pool-186-thread-1] m.p.d.s.g.GithubActionsPipelineService:Started data sync for Github Actions pipeline [name: example-pipeline-name, url: https://api.github.com/repos/example-org/example-repo]
INFO 2024-05-06 23:47:27.970 traceId: --- [pool-186-thread-1] m.p.d.s.g.RunService:Get Github Runs - Sending request to Github Feign Client with url: https://api.github.com/repos/example-org/example-repo, pageIndex: 1
ERROR 2024-05-06 23:47:59.744 traceId: --- [pool-186-thread-1] m.p.r.a.SynchronizationApplicationService:Synchronize failed for pipeline [example-pipeline-id - example-pipeline-name], error: [feign.codec.DecodeException: Error while extracting response for type [class metrik.project.infrastructure.github.feign.response.MultipleRunResponse] and content type [application/json;charset=utf-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Instantiation of [simple type, class metrik.project.infrastructure.github.feign.response.SingleRunResponse] value failed for JSON property head_branch due to missing (therefore NULL) value for creator parameter headBranch which is a non-nullable type; nested exception is com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class metrik.project.infrastructure.github.feign.response.SingleRunResponse] value failed for JSON property head_branch due to missing (therefore NULL) value for creator parameter headBranch which is a non-nullable type
 at [Source: (PushbackInputStream); line: 1, column: 646871] (through reference chain: metrik.project.infrastructure.github.feign.response.MultipleRunResponse["workflow_runs"]->java.util.ArrayList[50]->metrik.project.infrastructure.github.feign.response.SingleRunResponse["head_branch"])]
ERROR 2024-05-06 23:47:59.768 traceId:cc7efafa915d276f --- [http-nio-9000-exec-3] m.e.GlobalExceptionHandler:Unexpected exception happened with error message: Synchronize failed
metrik.project.exception.SynchronizationException: Synchronize failed
	at metrik.project.rest.applicationservice.SynchronizationApplicationService.synchronize$lambda-0(SynchronizationApplicationService.kt:42)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
	at java.base/java.util.concurrent.CountedCompleter.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
	at java.base.java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
	at java.base.java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
	at java.base.java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base.java.util.stream.ReferencePipeline.forEach(Unknown Source)
	at java.base.java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
	at metrik.project.rest.applicationservice.SynchronizationApplicationService.synchronize(SynchronizationApplicationService.kt:34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant