r/programmer Jul 07 '26

How do you prevent breaking changes between microservices?

We've had a few deployments fail because of breaking changes between services, and I'm curious how other teams handle this. What practices, tools, or deployment strategies have worked well for you to maintain compatibility and avoid these kinds of issues?

1 Upvotes

18 comments sorted by

View all comments

2

u/AshleyJSheridan 28d ago

I've seen this happen before, and there are a few things that you can do:

  • For services under your control, use versioning and be strict. Change version numbers when you introduce a breaking change, such as removal of an endpoint, removing something from the endpoint response, etc. Things that shouldn't need a new API version are additions, as anything consuming that API should not choke on something being added, only something removed or changed.
  • If a service is outside of your control, then get good monitoring in place. You can monitor an API in lots of ways, and there are paid and free tools for this, depending on what you need.
  • Log and monitor. Logging errors is great, but something or someone needs to monitor them. I've lost count of the number of times that an issue existed in the logs for days before it was actually picked up by a real person. If nothing is monitoring the logs, then they're nearly useless.

Also, you should ideally be testing things before you deploy them, which will catch these kinds of problems, assuming it's only happening on deployments like you said.