peburrows / kane

Google Pub/Sub client for Elixir
http://hexdocs.pm/kane
MIT License
104 stars 47 forks source link

GenServer.call(Goth.Config, {:get, "project_id"}, 5000) #18

Closed sandboxws closed 5 years ago

sandboxws commented 6 years ago

I'm trying to run the following task and I keep getting this exception

** (exit) exited in: GenServer.call(Goth.Config, {:get, "project_id"}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir) lib/gen_server.ex:821: GenServer.call/3
    lib/kane/message.ex:90: Kane.Message.path/1
    lib/kane/message.ex:30: Kane.Message.publish/2
    lib/kane/message.ex:22: Kane.Message.publish/2
    lib/mix/tasks/pubsub.ex:9: Mix.Tasks.Pubsub.run/1
    (mix) lib/mix/task.ex:314: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:80: Mix.CLI.run_task/2
    (elixir) lib/code.ex:677: Code.require_file/2
defmodule Mix.Tasks.Pubsub do
  use Mix.Task

  @shortdoc "Playground for gcloud pubsub"
  def run(_) do
    topic = %Kane.Topic{name: 'foobar'}
    message = %Kane.Message{data: %{"hello": "world"}, attributes: %{"random": "attr"}}

    result = Kane.Message.publish(message, topic)

    case result do
      {:ok, _return} -> IO.puts("It worked!")
      {:error, _reason} -> IO.puts("Failed to publish message")
    end
  end
end

The following is my mix.ex file

defmodule Broadcaster.Mixfile do
  use Mix.Project

  def project do
    [
      app: :broadcaster,
      version: "0.0.1",
      elixir: "~> 1.4",
      elixirc_paths: elixirc_paths(Mix.env),
      compilers: [:phoenix, :gettext] ++ Mix.compilers,
      start_permanent: Mix.env == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {Broadcaster.Application, []},
      extra_applications: [:logger, :runtime_tools],
      applications: [:kane]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_),     do: ["lib"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
      {:phoenix, "~> 1.3.2"},
      {:phoenix_pubsub, "~> 1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.10"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:gettext, "~> 0.11"},
      {:cowboy, "~> 1.0"},
      {:kane, "~> 0.2.0"}
    ]
  end

  # Aliases are shortcuts or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #
  #     $ mix ecto.setup
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      "test": ["ecto.create --quiet", "ecto.migrate", "test"]
    ]
  end
end

And finally my dev.exs

...
config :goth,
  json: "/Users/sandboxws/Documents/Unii-prod-daba6d92db8d.json" |> File.read!
peburrows commented 6 years ago

@sandboxws, sorry for the slow response, I was traveling over the weekend. I’m just catching up on issues from my open source projects, but I’ll take a look at this tomorrow to see if I can reproduce and hopefully provide some guidance.

peburrows commented 5 years ago

Never been able to reproduce and haven't heard of anyone else experiencing this issue, so closing.