petermueller / waffle_gcs

Google Cloud Storage for Waffle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Signed URL v2 returning error when using service account

jmalovera10 opened this issue · comments

Signed URL v2 returning error when using service account

Description

I am trying to generate a signed url using waffle with waffle_gcs. I configured my project according to the goth migration guide, and enabled the signed parameter in my config. The credentials are being set by using a JSON key, associated to a :service_account. However, when I call the url/1 function from my uploader I get the following error:

** (MatchError) no match of right hand side value: :error
    (waffle_gcs 0.2.0) lib/waffle/storage/google/url_v2.ex:82: Waffle.Storage.Google.UrlV2.build_signed_url/3
    (fliipa 0.1.0) lib/fliipa/uploaders/report_uploader.ex:6: Fliipa.Uploaders.ReportUploader.url/3
    iex:6: (file)

It seems that the client_email and private_key are not being set on the Goth.Config. I managed to make a workaround by explicitly setting the parameters in the Application module by using:

Goth.Config.set(:client_email, credentials["client_email"])
Goth.Config.set(:private_key, credentials["private_key"])

However, I don't know if this is an intended behavior or is a library failure.

Environment

  • Elixir 1.16.2 / OTP 25.3.2.10
  • goth 1.4.3
  • waffle 1.1.8 / waffle_gcs 0.2.0