Skip to content

Commit 4c744db

Browse files
committed
fix: ArgumentError 1st argument not an atom. Get from module instead of struct
1 parent cd19df8 commit 4c744db

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lib/sidecar/grpc/dispatcher.ex

+10-7
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,16 @@ defmodule Sidecar.GRPC.Dispatcher do
305305
defp build_actor_id_from_settings(_, _, _, _), do: nil
306306

307307
defp find_actor_name_and_ctype(message) do
308-
Enum.find_value(message.descriptor().field, fn %Google.Protobuf.FieldDescriptorProto{
309-
name: name,
310-
options: %Google.Protobuf.FieldOptions{
311-
ctype: ctype,
312-
__pb_extensions__: ext
313-
}
314-
} ->
308+
module = message.__struct__
309+
descriptor_proto = apply(module, :descriptor, [])
310+
311+
Enum.find_value(descriptor_proto.field, fn %Google.Protobuf.FieldDescriptorProto{
312+
name: name,
313+
options: %Google.Protobuf.FieldOptions{
314+
ctype: ctype,
315+
__pb_extensions__: ext
316+
}
317+
} ->
315318
Map.get(ext, {Eigr.Functions.Protocol.Actors.PbExtension, :actor_id}, false) &&
316319
{ctype, name}
317320
end)

0 commit comments

Comments
 (0)