Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctionClauseError on Forcex.Client.login #40

Open
mimimalizam opened this issue Nov 22, 2018 · 1 comment
Open

FunctionClauseError on Forcex.Client.login #40

mimimalizam opened this issue Nov 22, 2018 · 1 comment

Comments

@mimimalizam
Copy link

mimimalizam commented Nov 22, 2018

👋

For the time being, I'm not able to mitigate the following error, and I hope someone will be able to help me.

  • I added lines similar to the following to config/config.exs (replaced dummy text)
config :forcex, Forcex.Client,
  username: "[email protected]",
  password: "my_super_secret_password",
  security_token: "EMAILED_FROM_SALESFORCE",
  client_id: "CONNECTED_APP_OAUTH_CLIENT_ID",
  client_secret: "CONNECTED_APP_OAUTH_CLIENT_SECRET"
  • Calling Forcex.Client.login returns the following
10:34:42.335 [debug] conf=%{client_id: "xxxx", client_secret: "xxxx", password: "xxxx", security_token: "xxxx", username: "xxx"}
** (FunctionClauseError) no function clause matching in Forcex.Api.Http.process_response/1

    The following arguments were given to Forcex.Api.Http.process_response/1:

        # 1
        %{
          access_token: "xxxxx",
          id: "https://login.salesforce.com/id/xxxxx/xxxxxK",
          instance_url: "https://xxx.salesforce.com",
          issued_at: "1542879282532",
          signature: "xxxxxxxx",
          token_type: "Bearer"
        }

    Attempted function clauses (showing 5 out of 5):

        defp process_response(%HTTPoison.Response{body: body, headers: %{"Content-Encoding" => "gzip"} = headers} = resp)
        defp process_response(%HTTPoison.Response{body: body, headers: %{"Content-Encoding" => "deflate"} = headers} = resp)
        defp process_response(%HTTPoison.Response{body: body, headers: %{"Content-Type" => <<"application/json"::binary(), _::binary()>>} = headers} = resp)
        defp process_response(%HTTPoison.Response{body: body, status_code: 200})
        defp process_response(%HTTPoison.Response{body: body, status_code: status})

    (forcex) lib/forcex/api/http.ex:29: Forcex.Api.Http.process_response/1
    (forcex) lib/forcex/api/http.ex:18: Forcex.Api.Http.raw_request/5
    (forcex) lib/forcex/auth/oauth.ex:16: Forcex.Auth.OAuth.login/2
    (forcex) lib/forcex/client.ex:71: Forcex.Client.login/2

Alternatively, it would also help me if I could extract the access_token from above shared arguments.

Tnx!

@barkerja
Copy link

barkerja commented Dec 1, 2018

The issue appears to be due to parsing the request's response twice. I have a PR to resolve this: #41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants