HandlerDef missing from attrs in filter

A filter handles authorization and has a modifier to turn it on/off. There are a number of identical routes without the modifier set.

For one specific route the filter will fail with the exception:
play.api.UnexpectedException: Unexpected exception[NoSuchElementException: key not found: HandlerDef]
HandlerDef handler = requestHeader.attrs().get(Router.Attrs.HANDLER_DEF);

However, this does not happen when running locally during development but only in the Kubernetes environment. The routes are identical in their configuration but only one is failing consistently.

Play version 2.6.21

Nevermind, I was using the incorrect endpoint when calling the k8s instance…classic problem between chair and keyboard.

1 Like

I got the same error and I was missing one Query String in the URL. I guess I was reaching the last route? Still not sure why it happen but reaching the proper route make it work properly.