2

I am trying to build an app for serverless using sbt assembly. It works if I compile it using sbt assembly and then run it using serverless invoke local --function func, however if I run it using serverless offline start it will throw an error saying the config for akka is missing.

I already have the following in my sbt file:

assembly / assemblyMergeStrategy := {
  case PathList("META-INF", _ @_*)         => MergeStrategy.discard
  case PathList("reference.conf", _ @_*)   => MergeStrategy.concat
  case PathList("application.conf", _ @_*) => MergeStrategy.concat
  case "reference.conf"                    => MergeStrategy.concat
  case "application.conf"                  => MergeStrategy.concat
  case PathList("logback.xml", _ @_*)      => MergeStrategy.concat
  case PathList("logback-test.xml", _ @_*) => MergeStrategy.concat
  case _                                   => MergeStrategy.first
}
benthecarman
  • 125
  • 7
  • We need more context here: what is `serverless` command? What does it do differently with the JAR? Have you looked at the generated JAR? What does it contain? – Gaël J Nov 12 '21 at 18:20

1 Answers1

0

Akka does a sneaky little thing that might be tripping you up. If you look at the reference.conf in their jar you will see that not all of their configurations live in the reference.conf

# Akka version, checked against the runtime version of Akka. Loaded from generated conf file.
include "version"

so essentially you may have to add entries in your merge strategy for these additional files (which might have duplicates assuming they implement this pattern in their other libraries)

Andrew Norman
  • 843
  • 9
  • 22