T4(customer): fix gateway route transform to map /api/customers → /api/customer#67
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| "order-route": { | ||
| "ClusterId": "order-cluster", |
There was a problem hiding this comment.
🚩 Other service routes have the same prefix-stripping problem that this PR fixes only for the customer route
This PR adds PathPrefix: /api/customer to fix routing for the customer service, which uses [Route("api/[controller]")] resolving to api/Customer. However, the identity, order, product, and notification routes all have the identical issue: they strip /api/{service} via PathRemovePrefix but never re-add the controller prefix. For example, the order route strips /api/orders so /api/orders/5 becomes /5, which is forwarded to http://order-service:5003/5 — but the OrderController at src/Services/Order/Order.API/Controllers/OrderController.cs:6 expects api/Order/5. The same applies to IdentityController (src/Services/Identity/Identity.API/Controllers/IdentityController.cs:6), ProductController (src/Services/Product/Product.API/Controllers/ProductController.cs:6), and NotificationController (src/Services/Notification/Notification.API/Controllers/NotificationController.cs:9). These are pre-existing issues but this PR establishes the fix pattern — the other routes should likely get the same treatment.
(Refers to lines 24-28)
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Agreed — the other routes (identity, order, product, notification) have the same prefix-stripping gap. This PR is intentionally scoped to only the customer route per the task spec; fixing the others would be a separate follow-up.
Summary
The YARP gateway strips
/api/customersviaPathRemovePrefix, but the Customer service controller listens atapi/customer(singular). Requests likeGET /api/customersbecameGET /and 404'd.Added a
PathPrefixtransform so the route pipeline becomes:Example flows:
GET /api/customers→/→/api/customer(list endpoint)GET /api/customers/5→/5→/api/customer/5(get-by-id)POST /api/customers→/→/api/customer(create)Only
src/ApiGateway/appsettings.jsonchanged.Part of the Customer microservice carve-out stacked PR chain (T4/T5).
Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/df4fd98794c34738bf5a70c588276dcb
Requested by: @mbatchelor81