Fix product detail 404 — /products/{id} returns 404 in fixture mode #28

Closed
opened 2026-03-25 22:25:59 +00:00 by mik-tf · 1 comment
Member

Bug

GET /api/products/prod_gw_belgium01 returns 404 even though the product exists in the fixture data (visible in /api/products/featured).

The product listing endpoint works but individual product lookup by ID fails.

Impact

  • SPA product detail page shows error
  • Buy Now from product detail page doesn't work (can't load product info)
  • Only marketplace overview Buy Now works (from the card listing)

Root cause

Need to investigate: ProductService.get_product_by_id() in fixtures — the product catalog loads from JSON files but the ID lookup may not match.

Fix

Debug FixtureProductCatalog::get_product_by_id() and verify it searches by the correct ID field.

Test

  • curl /api/products/prod_gw_belgium01 → should return product JSON
  • Add to api_integration.sh test suite
  • Playwright: navigate to /products/{id} → verify product details render

Signed-off-by: mik-tf

## Bug GET /api/products/prod_gw_belgium01 returns 404 even though the product exists in the fixture data (visible in /api/products/featured). The product listing endpoint works but individual product lookup by ID fails. ## Impact - SPA product detail page shows error - Buy Now from product detail page doesn't work (can't load product info) - Only marketplace overview Buy Now works (from the card listing) ## Root cause Need to investigate: ProductService.get_product_by_id() in fixtures — the product catalog loads from JSON files but the ID lookup may not match. ## Fix Debug FixtureProductCatalog::get_product_by_id() and verify it searches by the correct ID field. ## Test - curl /api/products/prod_gw_belgium01 → should return product JSON - Add to api_integration.sh test suite - Playwright: navigate to /products/{id} → verify product details render Signed-off-by: mik-tf
Author
Member

Fixed — v1.3.2

Root cause

Axum 0.7.9 uses :id syntax for path parameters, not {id}. The {id} syntax silently does not match, returning 404 for ALL parameterized routes.

Fix

  • Changed all {id} to :id in routes.rs (40+ routes affected)
  • get_product_details now returns JSON (was rendering SSR HTML template)

Test-driven fix

  1. Test written: product detail by ID in api_integration.sh
  2. Test FAILED before fix
  3. Fix applied
  4. Test PASSES: success: True product: Belgium Gateway - Brussels
  5. All 23 integration + 33 Playwright tests pass

Regression test added

api_integration.sh now has: "Product detail by ID → found"

Signed-off-by: mik-tf

## Fixed — v1.3.2 ### Root cause Axum 0.7.9 uses `:id` syntax for path parameters, not `{id}`. The `{id}` syntax silently does not match, returning 404 for ALL parameterized routes. ### Fix - Changed all `{id}` to `:id` in routes.rs (40+ routes affected) - `get_product_details` now returns JSON (was rendering SSR HTML template) ### Test-driven fix 1. Test written: product detail by ID in api_integration.sh 2. Test FAILED before fix 3. Fix applied 4. Test PASSES: `success: True product: Belgium Gateway - Brussels` 5. All 23 integration + 33 Playwright tests pass ### Regression test added api_integration.sh now has: "Product detail by ID → found" Signed-off-by: mik-tf
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coopcloud_code/home#28
No description provided.