HTTP.jl unsupported keyword argument when running on Heroku, but same Docker container works fine on local machine

I have a simple Docker container (repo link) that successfully launches on my local machine, but produces a Julia error when I attempt to run it on Heroku. It seems to be complaining that verbose is an unsupported keyword argument in HTTP.serve. Full error text at the bottom of this message.

This is the same example file found in @amellnik’s Joseki.jl repo (but with verbose enabled in HTTP.serve).

Steps to reproduce:
(These are also found with more description in the github repo readme)

git clone https://github.com/milesfrain/JosekiHerokuExample.git
cd JosekiHerokuExample
heroku login
heroku container:login
HEROKU_APP_NAME="my-app-name"
heroku create $HEROKU_APP_NAME
heroku container:push web --app $HEROKU_APP_NAME
heroku container:release web --app $HEROKU_APP_NAME
heroku logs --tail --app $HEROKU_APP_NAME

Observe this error:

LoadError: MethodError: no method matching listen(::getfield(HTTP.Handlers, Symbol("##4#5")){HTTP.Handlers.Router{Symbol("##363")}}, ::String, ::String; verbose=true)
Closest candidates are:
  listen(::Any, ::Union{String, IPAddr}) at /joseki_demo/.julia/packages/HTTP/U2ZVp/src/Servers.jl:206 got unsupported keyword argument "verbose"
  listen(::Any, ::Union{String, IPAddr}, !Matched::Integer; sslconfig, tcpisvalid, server, reuseaddr, connection_count, rate_limit, reuse_limit, readtimeout, verbose) at /joseki_demo/.julia/packages/HTTP/U2ZVp/src/Servers.jl:206
  listen(::Any) at /joseki_demo/.julia/packages/HTTP/U2ZVp/src/Servers.jl:206 got unsupported keyword argument "verbose"
Stacktrace:
 [1] #serve#3(::Bool, ::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:verbose,),Tuple{Bool}}}, ::Function, ::HTTP.Handlers.Router{Symbol("##363")}, ::String, ::String) at /joseki_demo/.julia/packages/HTTP/U2ZVp/src/Handlers.jl:345
 [2] (::getfield(HTTP.Handlers, Symbol("#kw##serve")))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(HTTP.Handlers.serve), ::HTTP.Handlers.Router{Symbol("##363")}, ::String, ::String) at ./none:0
 [3] top-level scope at none:0
 [4] include at ./boot.jl:326 [inlined]
 [5] include_relative(::Module, ::String) at ./loading.jl:1038
 [6] include(::Module, ::String) at ./sysimg.jl:29
 [7] exec_options(::Base.JLOptions) at ./client.jl:267
 [8] _start() at ./client.jl:436
in expression starting at /joseki_demo/launch-server.jl:46

Run the same container locally and observe no errors:

docker run --rm -p 8000:8000 registry.heroku.com/$HEROKU_APP_NAME/web

Got things working with buildpacks. Here are example deployment repos using Genie.jl and Joseki.jl.
https://github.com/milesfrain/GenieOnHeroku
https://github.com/milesfrain/JosekiHerokuExample

Hi @milesf – did you figure out the docker-on-heroku issue by any chance? I’m running into the same issue on a different cloud provider.

@amellnik
Genie.jl has a guide for deploying a generic Docker container to Heroku. Hopefully this can be adapted for Joseki.jl or any other Julia web backend.

Here are the consolidated steps from a larger discussion on Genie.jl deployment.

# --- Julia -----
using Genie
Genie.newapp("MyGenieApp")
using Genie.Deploy.Docker
Docker.dockerfile()
Docker.build()

# --- System shell ------
HEROKU_APP_NAME=my-app-name
heroku create $HEROKU_APP_NAME
heroku container:push web -a $HEROKU_APP_NAME
heroku container:release web -a $HEROKU_APP_NAME
heroku logs -tail -a $HEROKU_APP_NAME

So… my MethodError was real. In constructing the dockerfile I forgot to parse the environment variable for the port to an integer, and that environment variable was unset on my local computer. I think this may have been what you ran into (and I think I’ve actually done this before).