Skip to content

(feature) migrate relay proxy from labstack/echo v4 to v5 #5294

@thomaspoignant

Description

@thomaspoignant

Summary

Migrate the relay proxy from github.com/labstack/echo/v4 to github.com/labstack/echo/v5 to benefit from the latest improvements, bug fixes, and API changes introduced in Echo v5.

Motivation

Echo v5 brings several improvements over v4:

  • Cleaner, more consistent API
  • Better error handling
  • Improved routing
  • Active development and support

Scope

The migration touches cmd/relayproxy/ and cmdhelpers/api/middleware/.

Dependencies to update

Current Target
github.com/labstack/echo/v4 v4.15.2 github.com/labstack/echo/v5
github.com/labstack/echo-contrib Check v5 compatibility or find alternatives
go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho Check v5 compatibility

Middleware to validate

All existing middleware must keep working after the migration:

Built-in middleware (currently from echo/v4/middleware):

  • middleware.BodyDumpWithConfig — used for debug logging
  • middleware.CORSWithConfig — CORS support
  • middleware.Recover — panic recovery

Third-party middleware:

  • echoprometheus.NewMiddlewareWithConfig (from echo-contrib) — Prometheus metrics
  • otelecho.Middleware — OpenTelemetry tracing

Custom middleware (cmd/relayproxy/api/middleware/):

  • KeyAuthExtended — API key authentication (user + admin)
  • VersionHeader — adds version header to responses
  • StreamAuthorizer — SSE stream authorization
  • AuthMiddlewareErrHandler — custom auth error handler

Helper middleware (cmdhelpers/api/middleware/):

  • ZapLogger — structured request logging with Zap

Acceptance Criteria

  • All middleware listed above works correctly after migration
  • All existing tests pass
  • No regression in authentication, CORS, metrics, tracing, or logging
  • echo-contrib and otelecho updated or replaced with v5-compatible alternatives
  • Lambda adapter (api/aws_lambda.go) still works

Notes

Echo v5 introduced breaking changes from v4. Key API differences to review:

  • echo.Context interface changes
  • Middleware signature changes
  • Error handler changes
  • Router API changes

Check the Echo v5 migration guide before starting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions