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

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
belgoros
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
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
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
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

We're in Beta

About us Mission Statement