francois1
Failed to start child: ** (EXIT) already started
I want to share a Finch app among Umbrella apps.
- In foo_app:
def start(_type, _args) do
children = [
{Finch, name: MyAppServer.Finch},
- In bar_app:
def start(_type, _args) do
children = [
{Finch, name: MyAppServer.Finch},
This leads to the error:
Application bar_app exited: BarApp.Application.start(:normal, ) returned an error: shutdown: failed to start child: MyAppServer.Finch
Is there any way to start the app only if not already available?
Other options:
-
start it only from one of the apps
=> but what if I want to start the other app (which wouldn’t start Finch) independently -
use 2 Finch instances
=> the Swoosh mailer accepts only one Finch instance -
start it in a shared app
=> ultimately possible if no other easier solution
Most Liked
benwilson512
You aren’t starting an app, you are defining an instance of Finch, monitored in your apps supervision tree, with a name. You’re explicitly starting it twice with the same name.
If you plan to use it from Swoosh and you want just one swoosh config then you should run finch in whatever app is using swoosh. If multiple apps are using swoosh then I would start two finch instances and configure each swoosh to use one.
Ultimately issues like this are why I abandoned umbrella apps. The “you might start parts of it separately” part was always theoretical, and the dependency struggles was always concrete and ever present.
benwilson512
That seems like a major deficiency in swoosh then. Most elixir apps have gone away from singleton configuration for this and other reasons.
Popular in Questions
Other popular topics
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









