Laetitia
Hi everybody,
I try to use :rpc.call to create an entity on another node like this:
:rpc.call(:node@me, MyApp, :create_toto, [%{}])
create_toto builds a changeset for Toto Schema and calls Repo.insert.
When the changeset is valid, everything is ok and the result is as expected.
But when the changeset is not valid, i get this error:
{:error,
%Inspect.Error{
message: "got UndefinedFunctionError with message \"function Toto.__schema__/1 is undefined (module Toto is not available)\" while inspecting %{__struct__: Ecto.Changeset, action: :insert, changes...... }}
The function works well on its own node.
Can anybody explain this behaviour?
Thanks ![]()
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #elixirconf-us
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
crova
Does
:create_totoresides inMyApp?I think you should be passing something like
MyApp.Totoas the second argument orToto, idk::rpc.call(:node@me, MyApp.Toto || Toto, :create_toto, [%{}]).The second argument should be the module that defines the function you’ll be calling.
Laetitia
Yes,
create_totois a very basic function of theMyAppmodule like this:crova
And Toto is an alias?
Also, could you put all the code involved here? Might be easier seeing everything.
Laetitia
Okay, i give a try report it simply:
I am writting this code here for the report. It is not the real code but it allows to understand what is going on.
This app runs on a node A.
The second node try to call like this
and on changeset error, get the
{:error, %Inspect.Error{}..}crova
Is the second node the same app as on node A or a different one?
I’m not sure how rpc deals with function calls that invoke functions from other modules. I only ever called functions that don’t rely on other modules.
But from the looks of it, it does not have
MyApp.Totoavailable. Maybe tryimporting theMyApp.Totomodule.Laetitia
I found that if i don’t run
:rpc.callfrom an app, a.k.a, execute directlyi get something like
So it seems that the
:rpc.callcaller try to inspect the changeset.The changeset seems to be inspected with
structs: false.But why and were it is done?
My real problem is that i have problems when i get changeset errors from another node.
voltone
The calling node is trying to inspect the
Ecto.Changeset, which has a customInspectprotocol implementation that in turn is trying to render theTotostruct that’s embedded inside it. It seems that it does not consider the possibility that the:datafield in the changeset is a struct from a module that doesn’t exist locally.(Edit: it is trying to call
__schema__/1on that module here)To prevent the error, force the local console to not try and call the
Ecto.Changesetinspect implementation, for example by callingIEx.configure(inspect: [structs: false])before the:rpccall.Alternatively you could monkey-patch
Ecto.Changesetfrom within iEx:Laetitia
Hi
thank you for the response.
I wonder who is doing the inspect and when it occurs.
And does it means we cannot rely on remote node creation via changeset??
elielhaouzi
Does that mean that an ecto.changeset error cannot be passed between nodes ?
voltone
IEx on the local node is calling inspect on the value returned by
:rpc.call/4. So by that time the RPC itself was completed, the exception happens locally in the console.The RPC worked just fine, and if the call didn’t happen in the console but in some local code, you could process the returned changeset normally. It’s just the rendering in the console that fails in this case. You would have similar problems if you were to try and log the changeset, for example.
You could open a ticket on Ecto to see if the team might consider handling this more gracefully. The question then is what fields should be redacted, because that’s what the custom
Inspectprotocol is trying to do: hide sensitive data. If the struct is not known locally, how can the changeset inspection decide which fields to show? Should it redact all fields, out of an abundance of caution? Maybe…