s-stepien

s-stepien

Hi

I have fairly complicated Phoenix app (but it doubt that this is Phoenix related issue?). In it I have the MyApp.Application module with start(_type, _args) function. I noticed today (after long time without working on it), that the start() function isn’t called at all. In the mix.exs file, the mod: is set correctly to that module - I haven’t changed anything there.

How one can try to debug this? What is happening before call to start() - maybe something there hangs?

I’ve tried rebuild from scratch, re-get deps, etc. And nothing, the function will not be called.
When I created new project, all seems OK in it.

I’m using Erlang/OTP 28.1 and Elixir 1.18.4

Update:
If I use MIX_ENV=prod, then I can see print at the beginning of the start() function. But I want to use the dev env :slight_smile:

Showing Posts 1 to 10

garrison

garrison

That start callback is what starts the Endpoint, so if it isn’t being called you have no server/app at all. Is that what you’re experiencing?

s-stepien

s-stepien OP

Well I think it is not about Endpoint (I have more children, not just the Phoenix ones). I have IO.inspect(“here”) as 1st instruction in start() function (before the children definition). And it is not printed.

And I have mix.exs with application/server definitions that are OK (I haven’t changed them for like years now).

garrison

garrison

I asked a specific question because I am trying to narrow down what is going on. If start/2 is not being called then your app must not be starting.

Is your application starting? Is the web server running? Does it work?

jswanner

jswanner

I believe @garrison is trying to get at is if any of the children in your application are running, if so then your application is running, and your endpoint is an easy one to test if it’s running.

How are you running your application? mix phx.server from the terminal, or some other way? Is it possible something is swallowing that IO you are using to debug? Instead of IO.inspect("here") you can try raise "here"

s-stepien

s-stepien OP

@garrison none of the children are started. The function is not called/entered.

@jswanner even with raise “here” it will not stop it. I’m using iex -S mix phx.server with some env variables.

Note that with MIX_ENV=prod it works, every time. With MIX_ENV=dev it does not. Only this MIX_ENV is different in invocation.

garrison

garrison

That is odd. I don’t know off the top of my head anything that would cause that behavior, though perhaps someone else will think of something.

Given that the behavior is different between environments you may want to comb through the configs for anything that could be different, though again I’m not sure what that might be.

As for your question about what happens when the application starts, it’s described quite thoroughly in the Application docs.

dimitarvp

dimitarvp

Then the culprit should be config/prod.exs or config/runtime.exs or any code that branches on the environment variables.

jswanner

jswanner

diff _build/{dev,prod}/lib/<app_name>/ebin/<app_name>.app
s-stepien

s-stepien OP

It seems that the issue is with:

# Watch static and templates for browser reloading.
config :myapp, MyAppWeb.Endpoint,
  live_reload: [
    patterns: [
      ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ...
    ]
  ]

Without this feature configured, the dev comes up. I wonder what might be the issue here. I will double check my paths here.

dimitarvp

dimitarvp

I take it that you redacted the app name and module namespace in the snippet above and they’re not the same in the real code? Just making sure.

Also does this code look the same in a freshly generated project?

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Blokh
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
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews