aws-serverless-java-container: Spark integration fails due to web sockets not being supported

I have a working hello-world-ish local Spark server, but when trying to run it on Lambda it throws the UnsupportedOperationException when the embedded server tries to configure web sockets.

Here’s the exact error I’m getting:

START RequestId: <request_id_redacted> Version: $LATEST
[main] INFO <class_redacted> - Initializing routes
[Thread-0] ERROR spark.Spark - ignite failed
java.lang.UnsupportedOperationException
	at com.amazonaws.serverless.proxy.spark.embeddedserver.LambdaEmbeddedServer.configureWebSockets(LambdaEmbeddedServer.java:65)
	at spark.Service.lambda$init$2(Service.java:502)
	at java.lang.Thread.run(Thread.java:745)
END RequestId: <request_id_redacted>
REPORT RequestId: <request_id_redacted>	Duration: 1501.41 ms	Billed Duration: 1600 ms 	Memory Size: 512 MB	Max Memory Used: 54 MB	
RequestId: <request_id_redacted> Process exited before completing request

I can’t see a current workaround other than some crazy reflection magic. I guess there are some potential fixes like:

  • change LambdaEmbeddedServer.configureWebSockets() to not throw an exception
  • use a custom initExceptionHandler on the Spark.Service instance to ignore the exception

Thoughts?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22

Commits related to this issue

Most upvoted comments

Resolving now that the fix is verified and about to go out