Skip to content

T4(customer): fix gateway route transform to map /api/customers → /api/customer#67

Open
devin-ai-integration[bot] wants to merge 1 commit into
devin/customer-service-t3from
devin/customer-service-t4
Open

T4(customer): fix gateway route transform to map /api/customers → /api/customer#67
devin-ai-integration[bot] wants to merge 1 commit into
devin/customer-service-t3from
devin/customer-service-t4

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The YARP gateway strips /api/customers via PathRemovePrefix, but the Customer service controller listens at api/customer (singular). Requests like GET /api/customers became GET / and 404'd.

Added a PathPrefix transform so the route pipeline becomes:

PathRemovePrefix: "/api/customers"  →  PathPrefix: "/api/customer"

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.json changed.

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


Open in Devin Review

@mbatchelor81 mbatchelor81 self-assigned this Jun 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines 24 to 25
"order-route": {
"ClusterId": "order-cluster",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 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)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Successfully merging this pull request may close these issues.

1 participant