Replies: 1 comment
-
|
Nine times out of ten this is |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Actix-web Route Matching Issue: Routes Register But Return 404
Environment
web::resource()for dynamic path routesProblem
I'm registering video frame extraction endpoints in Actix-web, but they return HTTP 404 despite being successfully registered at startup. The handler functions are never called.
Evidence That Routes ARE Registered
Startup logs confirm both routes register successfully (4 times, once per worker):
Code: Route Registration Pattern (BROKEN)
video_handler.rs:
main.rs (App configuration):
Code: Working Pattern for Comparison
admin_products.rs (this DOES work):
Handler Signatures
Video handler (never called):
Test Evidence
Request:
Response:
Logs after request:
For comparison, working endpoint:
What I've Tried
.route()chaining (didn't register routes)web::scope()pattern (scope collision with admin_products)web::resource()pattern (routes register but don't match)Questions for the Community
Why does
web::resource("/api/admin/products/{id}/video-info")register successfully but not match incoming requests?Is the issue route precedence? Does
admin_products::web::scope("/api/admin/products")consume all requests to that path beforevideo_routesresources can match?What's the correct Actix-web pattern for registering dynamic path routes in a separate module that will actually match and route to handlers?
Should these routes be added directly to
admin_products.rsinstead of trying to register them separately?Additional Context
/api/admin/products) work fineTL;DR: Routes register at startup (confirmed by logs), but don't match incoming requests (404). Handler functions never execute. What's the correct Actix-web pattern for dynamic path routes that will actually match?
Beta Was this translation helpful? Give feedback.
All reactions