benonymus
(FunctionClauseError) - why I am getting this or how to fix it?
So the erro meassage is :
(exit) an exception was raised:
** (FunctionClauseError) no function clause matching in MyApiWeb.FallbackController.call/2
And the code where it is coming from is :
def create(conn, %{
"description" => description,
"email" => email,
"source" => source,
"subscriptionID" => subscriptionID
}) do
with {:ok, %t{} = t} <- Stripe.Customer.create(%{description: description, email: email}) do
conn
|> IO.inspect(t)
end
end
Thanks
Marked As Solved
idi527
The original error says that no function head in MyApiWeb.FallbackController matches what’s returned from your create controller action. MyApiWeb.FallbackController, judging by your code snippet, can match either {:error, %Ecto.Changeset{} = changeset} or {:error, :not_found}, and nothing else. So if it receives, for example, %Stripe.User{}, it just doesn’t know what to do with it. You can add a new function which would match what’s returned from the create action and the error would disappear, but I doubt that’s what you actually want. I think the real problem is with the pattern in your with statement, {:ok, %t{} = t}.
Also I tried what khm idiot suggested and with that for the first try it went throug nicely but for the second one got the stripe user printed out and got the same fallback error
![]()
But printed out where? If you mean IO.inspect, then for which label, unmatched? If so, then that’s your solution right there – fix your pattern in with to match on a stripe user so that it doesn’t fail.








