Changing startup port on Scala SDK

In the Java sdk, I can start the service, locally, with a different port, through the use of the PORT env variable. I try that with the Scala SDK and it does not work.

How can I configure the sbt run command to use a different port than 8080?

I suspect answer could be here:Unsure How Calling Another Service Works? - #3 by HarveyEllis

but haven’t confirmed.

The PORT environment variable should be used by the Scala SDK. I tried

export PORT=8081
sbt run
14:53:43.705 [] DEBUG - Successfully bound to /
14:53:43.712 [] DEBUG - gRPC server started

You might have to enable debug logging in logback.xml to see that log message:

<logger name="akka" level="DEBUG"/>

Weird. I could swear that I tried! Will try again! Thanks!

Maybe that helps for someone else (as I had the same problem running multiple services locally):

  • in the resource folder, create application.conf
    add the following:
    akkaserverless.user-function-port = 8081

of course for the akka-serverless-proxy (docker-compose.yaml) change ‘USER_FUNCTION_PORT’ accordingly:
image: Google Cloud Platform
command: -Dconfig.resource=dev-mode.conf
- “9001:9000”
- “host.docker.internal:host-gateway”
PUBSUB_EMULATOR_HOST: gcloud-pubsub-emulator

Maybe an update on this page:

At the end of the page, there is a reference to ‘start’ method. It took me some time to know how to deal with that :slight_smile:

Did you solved your issue i have same issue and trying to figure it out suggest the answer.