atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

getting pull request: json: cannot unmarshal number Edit into Go struct field GitCommitDiffs.changeCounts of type azuredevops.VersionControlChangeType

Open Froostx opened this issue 8 months ago • 6 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

I upgraded my atlantis image to 0.34.0 and now i get this error when i try to atlantis plan in my Azure Devops PullRequest. getting pull request: json: cannot unmarshal number Edit into Go struct field GitCommitDiffs.changeCounts of type azuredevops.VersionControlChangeType

Reproduction Steps

Upgrade to 0.34.0

Environment details

  • Atlantis version: 0.34.0
  • Deployment method: ecs/eks/helm/tf module

Froostx avatar Apr 07 '25 15:04 Froostx

Hello @Froostx! I'm here to help you with any bugs or questions you might have while you wait for a human maintainer. Feel free to ask me anything!

The error you're encountering, "json: cannot unmarshal number Edit into Go struct field GitCommitDiffs.changeCounts of type azuredevops.VersionControlChangeType," suggests a type mismatch issue when Atlantis is trying to unmarshal JSON data from Azure DevOps. This issue likely arises from a change in the JSON response format or a change in the Atlantis codebase related to how it handles Azure DevOps data.

To address this issue, you can try the following steps:

  1. Check for Updates or Patches: Ensure that you are using the latest version of Atlantis, as there might be a patch or update that addresses this issue.

  2. Review Release Notes: Look for any release notes or documentation related to version 0.34.0 that might mention changes in how Azure DevOps data is handled. This could provide insights into the cause of the issue.

  3. Inspect the Code: If you have access to the code, inspect the GitCommitDiffs struct and the azuredevops.VersionControlChangeType to understand the expected data types. This might help in identifying the mismatch.

  4. Modify the Code: If you are comfortable with Go, you might consider modifying the code to handle the type mismatch. This could involve changing the data type of the changeCounts field or implementing a custom unmarshalling function to handle the conversion.

  5. Revert to a Previous Version: As a temporary workaround, consider reverting to a previous version of Atlantis that did not have this issue, if feasible.

If none of these steps resolve the issue, further investigation into the specific changes in version 0.34.0 or the JSON response format from Azure DevOps might be necessary.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Apr 07 '25 15:04 dosubot[bot]

I'm getting the same problem after i've upgraded from 0.33.0 to 0.34.0, i'm using Azure DevOps too. The workaround is to downgrade to 0.33.0 atlantis version

davidegiunchi avatar Apr 15 '25 13:04 davidegiunchi

same here, downgrading to 0.33 fixes it.

MeesvanStraten avatar Apr 18 '25 13:04 MeesvanStraten

We have the same issue. Downgrading fixes it, but we want to move to v0.34.0 because of #5298

SilvanoBemer avatar Apr 22 '25 09:04 SilvanoBemer

Looks like problem that I described in this pull request. I tested it locally and it looks good. I'll test it on our Atlantis stack and I will prepare PR for that in a few days.

bub3n avatar Jun 08 '25 18:06 bub3n

Im having the same issue. It throws that error on webhooks for PR creation. We are using atlantis plan -p <project> and atlantis apply -p <project>as a workaround as the defining the specific project seems to work(or maybe the webhook format is different for PR comments/updates).

Im using Azure DevOps and atlantis v0.34.0

Image

LeandroLeon102 avatar Jun 19 '25 14:06 LeandroLeon102

Can someone verify that version v0.35.0 fixed the issue? Did not have time to test it in a new version.

When we tried it in our build it worked, just want to be sure. @MeesvanStraten @davidegiunchi @Froostx

bub3n avatar Jul 07 '25 14:07 bub3n

@bub3n I upgraded from 0.34.0 -> 0.35.0, seems to work now. The only thing I noticed is that the credentials for the old Azure DevOps (.visualstudio.com) are only being stored on the credentials file on Pull Request Creation servicehook but I guess this is Ok.

Seems like once a Pull Request is created and the credentials are stored, you can use atlantis even on PRs created previously as the credentials are already stored.

LeandroLeon102 avatar Jul 07 '25 14:07 LeandroLeon102

Can someone verify that version v0.35.0 fixed the issue? Did not have time to test it in a new version.

When we tried it in our build it worked, just want to be sure. @MeesvanStraten @davidegiunchi @Froostx

Upgraded to 0.35.0 and seems to work. Thanks!

Froostx avatar Jul 07 '25 14:07 Froostx

Thank you for testing! :)

bub3n avatar Jul 07 '25 17:07 bub3n

Confirmed that version 0.35.0 is functional in AzDo.

jbiel avatar Jul 07 '25 18:07 jbiel

Can someone verify that version v0.35.0 fixed the issue? Did not have time to test it in a new version.

When we tried it in our build it worked, just want to be sure. @MeesvanStraten @davidegiunchi @Froostx

Yes, it works! thank you

davidegiunchi avatar Jul 09 '25 07:07 davidegiunchi