tanweerdev
When running a multi in Repo.transaction, I dont get error or ok back
I have a multi exactly below
%Ecto.Multi{
names: #MapSet<[:record_0]>,
operations: [
record_0: {:changeset,
#Ecto.Changeset<
action: :insert,
changes: %{
app_version: "0.7.0",
card_id: "37faf84a-afdd-48b5-a9bd-20b789790153",
merchant_device_id: "71aefe98-dfa8-4ba3-97ed-20419fab44f5",
merchant_device_transaction_number: 0,
merchant_player_id: "8ea9abcd-0c26-450d-b1d8-ed0f364b8355",
purchase_amount: #Decimal<88.0>,
purchase_metric_id: "3b7f242c-8831-4066-a91c-928d77764bb9",
transaction_id: "a49cca05-e090-42ba-bb85-bae58ea4d055"
},
errors: [],
data: #Pogio.V1.TransactionPurchase<>,
valid?: true
>, []}
]
}
But when I run
Repo.transaction(multi)
Boom nothing happens, no crash, no log. and I got back nothing. infact control is not returned and 500 response is sent back to user.
Elixir version (elixir -v):
Elixir 1.10.2 (compiled with Erlang/OTP 21)
Erlang/OTP version (erl):
Erlang/OTP 21
Operating system:
Erlang/OTP 21
Is this an umbrella application?:
yes
Release type (Distillery, mix release, Mix, etc.):
iex -S mix phx.server
its working perfectly fine in some cases but not in one case. Any help or workaround or help in debugging is really appreciated
Marked As Solved
al2o3cr
Repo.transaction will raise on a constraint failure, unless the corresponding check_constraint or similar function is used to tell the changeset how to handle the situation.
If your code doesn’t rescue the exception, Phoenix will, and then call the fallback controller.
1
Popular in Questions
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I’m writing a test for one of the...
New
For example for a current url like
http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2,
I would like to get:
...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
I am trying to implement my new.html.eex file to create new posts on my website.
new.html.eex:
<h1>Create Post</h1>
<%= ...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
The documentation above suggests that while ...
New
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hi everyone,
I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Other popular topics
lets say i have a sample like
a = 20; b = 10;
if (a > b) do
{:ok, "a"}
end
if (a < b) do
{:ok, b}
end
if (a == b) do
{:ok, "equa...
New
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









