peburrows / goth

Elixir package for Oauth authentication via Google Cloud APIs
http://hexdocs.pm/goth
MIT License
289 stars 111 forks source link

Could not start `Application` (example from docs) #148

Closed nichita-pasecinic closed 2 years ago

nichita-pasecinic commented 2 years ago

Error:

** (Mix) Could not start application goth: Goth.start(:normal, []) returned an error: shutdown: failed to start child: Goth.Config
    ** (EXIT) an exception was raised:
        ** (RuntimeError)  Failed to retrieve project data from GCE internal metadata service.
                   Either you haven't configured your GCP credentials, you aren't running on GCE, or both.
                   Please see README.md for instructions on configuring your credentials.
            (goth 1.2.0) lib/goth/config.ex:182: Goth.Config.determine_project_id/2
            (goth 1.2.0) lib/goth/config.ex:73: anonymous fn/2 in Goth.Config.load_and_init/1
            (elixir 1.14.0) lib/enum.ex:1662: anonymous fn/3 in Enum.map/2
            (stdlib 4.0.1) maps.erl:411: :maps.fold_1/3
            (elixir 1.14.0) lib/enum.ex:2480: Enum.map/2
            (goth 1.2.0) lib/goth/config.ex:71: Goth.Config.load_and_init/1
            (stdlib 4.0.1) gen_server.erl:848: :gen_server.init_it/2
            (stdlib 4.0.1) gen_server.erl:811: :gen_server.init_it/6
            (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
credentials =
      "service_account.json"
      |> File.read!()
      |> Jason.decode!()

source = {:service_account, credentials} # => correct service account credentials here

# inside children list
{Goth, name: Guava.Goth, source: source}
nichita-pasecinic commented 2 years ago

damn, all good, Just used an older version of the library

On {:goth, "~> 1.3"} works perfectly! Thx for the lib 😄