klo

klo

Ex_aws lambda invoke is undefined

i have an app app1 which uses ExAws.Lambda.invoke/4. All is well and no compile warnings.

Another app say app2 uses app1 as a dependency. For some reason I get a compile warning: ExAws.Lambda.invoke/4 is undefined (module ExAws.Lambda is not available or is yet to be defined) lib/app2/client.ex:40: App2.Client.get_page/2.

Now in App1, i have aliased
alias ExAws.Lambda and calling the function as such:

 function_name
    |> Lambda.invoke(
      config,
      %{},
      invocation_type: :request_response
    )
    |> ex_aws.request()

The warning comes from app2 on a fresh compile but not on subsequent compiles even when forced using the --force option. I also have to remove _build and deps for the warning to show.

Marked As Solved

fireproofsocks

fireproofsocks

The cause can be if the “child” app has any options in its mix.exs that qualify the dependency, e.g.

{:ex_aws_lambda, "~> 2.0.2", optional: true}

might need to be just:

{:ex_aws_lambda, "~> 2.0.2"}

The optional parameter is one of those weird gotchas that in effect makes the child app say “hey parent – your call on what to do here.” In effect, it requires the parent app to be aware of what the child app is doing EVEN IF the parent isn’t directly calling that dependency.

Last Post!

klo

klo

yep! the solution was to remove the optional: true and all was fine. The warning was gone from the parent app.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
greenz1
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
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jason.o
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

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44608 311
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement