Ambiguous route resolution serving route

195 views
Skip to first unread message

Laurynas Šikšnys

unread,
Jun 19, 2017, 3:02:02 PM6/19/17
to Lagom Framework Users
Dear Members,

I'm using Lagom 1.3.5 and have a fairy complex service specification.
In the dev mode, I receive a weird warning:

[warn] c.l.l.d.ServiceLocatorServer - Ambiguous route resolution serving route: Route(GET,/api/appliance/schedule). Route served by /0.0.0.0:57920 but also matches [/0.0.0.0:57920].

The service works fine, but it seems that the ambiguous route resolution complains about the only possible URL to serve this route.

For other routes of the same service, e.g., "/api/appliance/:id" all is good, and I don't get any warnings.

Do you know how I can prevent these without totally disabling the ambiguous route resolution?

PS. I had the same issue with older versions of Lagom.

Apart, Lagom is a great framework ;-)

Regards,
Laurynas

Ignasi Marimon-Clos i Sunyol

unread,
Jun 20, 2017, 7:28:24 AM6/20/17
to Lagom Framework Users
Hi Laurynas,

that warning is displayed when the DevMode Gateway finds many services that may fulfill a given request (given a route on a request).
The strange thing is that all the services listed in the error message are the same one. This probably means you have ambiguous paths.

IIUC your service includes both:
 - /api/appliance/schedule and 
 - /api/appliance/:id

which would be an ambiguity: "is `schedule` a segment in the path or is it the value of an ':id' ?"
The trace is set to warning because the reverse routing in the service gateway is not handled by Lagom in production environments and depending on your implementation of that reverse routing your production setup could fail to redirect the request to the appropriate service. It was meant to detect when two services offer the same paths.
In your case, because both offending paths belong to the same service you will not incur in the error I just described (two services offering ambiguous paths). A future implementation of Lagom or even a refactor of your service could change the order in which the routes are built inside Lagom and that could break your application at runtime though.


Hope that helps,






--
You received this message because you are subscribed to the Google Groups "Lagom Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framework+unsubscribe@googlegroups.com.
To post to this group, send email to lagom-framework@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lagom-framework/3062c862-262f-4cb1-bce8-f40810a01b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ignasi Marimon-Clos
Software Developer @ Lagom

Laurynas Šikšnys

unread,
Jun 20, 2017, 11:13:47 AM6/20/17
to Lagom Framework Users
Hi Ignasi,

Thank you for the clarification. Now it is clear to me where the path ambiguity comes from, and what are the consequence in the production environment.
I will rework my paths to avoid these. Many thanks!

Regards,
Laurynas
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framewo...@googlegroups.com.
To post to this group, send email to lagom-f...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages