Hello - I tried today to add new features to a messaging server using Websocket I worked on a few weeks ago. At the time I was using Akka HTTP 10.1.2. The language to bind to an HTTP connection was
val binding = Http().bindAndHandle(route, "localhost", 8080)
taking in an implicit untyped ActorSystem
Since the change in versions, it’s now become
val binding = Http(system).newServerAt("localhost", 8080).bind(route)
Where system is a reference to a typed ActorSystem (I have two, I need one to spawn unmonitored actors).
This is all fine and good, but when I run it with the same route, my websocket server doesn’t connect. When I use websocat to smoke test, I get
I did some debugging, tried to make a simpler Websocket route, and it seems it doesn’t even invoke my websocket route. So I said “whatever, I will finish my feature, and file a ticket to upgrade Akka HTTP versions later”. Turns out I can’t do that, because https://repo1.maven.org/maven2/com/typesafe/akka/akka-http-core_2.13/ doesn’t contain the Akka HTTP version I used to build this a few weeks ago.
This really sucks, because now instead of developing I am stuck trying to figure out why something that worked fine a few weeks ago doesn’t work in a new version which is not even a major version, and I don’t even have the option to just not upgrade. The learning curve on Scala and Akka is steep enough without this.
OK, managed to make the server register that it’s a WebSocket server, but the following doesn’t work:
I used to have several different routes which I unioned with the ~ operator. That doesn’t work anymore apparently
I get Ask timed out on [akka://my-system] after [3000 ms]. Message of type [akka.actor.typed.SpawnProtocol$Spawn]. A typical reason for AskTimeoutException is that the recipient actor didn't send a reply. my-system is the actor system I pass to the Http() object; this is new, and I don’t know what it’s supposed to do.
Honestly, I am really frustrated that something that was working fine suddenly doesn’t anymore. I am just going to switch to a different HTTP framework for Scala like Http4s. I spent all the time I wanted to work on a feature trying to debug issues with Akka HTTP.
sorry about that experience. Hard to say what’s wrong here but there’s nothing obvious that would prevent 10.2.0 from working as before with regard to WebSockets or the ~ operator.
What version is that? It would be very surprising if Maven Central would start removing old versions.I guess the reason is that 10.1.2 didn’t yet support Scala 2.13, so maybe you updated multiple things at once? If you have these kinds of updating problems, try updating one thing at a time and first update to the latest patch version (10.1.12) first before making the bigger jump to 10.2.0.
Going from 10.1.2 to 10.2.0 means you are getting 2 full years of changes. The same might be true for doing the switch to Scala 2.13. Did you also change the Akka version? What versions did you start with, what versions did you end up with? I’d try Akka 2.5.31, Akka HTTP 10.1.12, and Scala 2.12.12 first before doing any of the larger jumps. Scala 2.13 should be safest, then try Akka HTTP 10.2.0 and Akka 2.6.9.
Do you use SpawnProtocol manually or is that something that happened automatically due to an upgrade of the Akka version?