VerifiedRoutes warning: no route path

I have updated a phoenix application to 1.7 and started using verified routes. When the app compiles, it issues warnings that there is no route path.

warning: no route path for CogitoWeb.Router matches "/portal/configuration/system/log_storage"
  lib/cogito_web/live/portal/configuration/system/log_storage.ex:58

However, it appears that the router does have the routes.

portal_configuration_log_storage_path  GET     /portal/configuration/system/log_storage    CogitoWeb.Portal.Configuration.System.LogStorageLive :show

Furthermore, the links work, so I can’t figure out why it is issuing warnings.

1 Like

How are you calling the route?

It’s possible this thread might shed some light on your situation.

1 Like

Let’s see how you are calling it. can you show what the call looks like?

IE whats on
lib/cogito_web/live/portal/configuration/system/log_storage.ex:58

1 Like
     |> push_patch(
       to: ~p"/portal/configuration/system/log_storage",
       replace: true
     )}

What about your routes file? Is it possible you’re calling out to a subdomain or something (like with the :host option)?

(edited) Wrong answer, apologies.

  scope "/portal/configuration", CogitoWeb, as: :portal_configuration do
    pipe_through([:browser, :portal_layout, :require_authenticated_user])

    live_session :config,
      on_mount: [
        CogitoWeb.UserLiveAuth
      ] do
      live("/system/log_storage", Portal.Configuration.System.LogStorageLive, :show)
    end
  end

Whats the scope look like cause this alone is not going to say if that matches, from this only that warning is valid.

Edit: oops sorry just mis read your comment, I see the scope now outside the code block.

Ok next try this.

mix phx.routes

Oh wait your first comment includes that? :thinking:

portal_configuration_log_storage_path  GET     /portal/configuration/system/log_storage    CogitoWeb.Portal.Configuration.System.LogStorageLive :show

This is odd to me, your ~p is a string literal so thats not likely the issue, the phx.routes show its been set. Sorry this is a hard one. Not really sure what next.

As a sanity check this is for the module CogitoWeb.Router? also maybe just try rewording the route to something like /foobarbaz just to see if you can get the warning constantly.

I’m with @polygonpusher and at a loss. My only suggestion would be to try and remove the :as as I don’t think it’s needed, though I have no idea why that would affect anything. Just a hail mary at this point. I’ve never run into something like this before. Would have to see more context of how you have stuff set up.

Same warnings with :as removed.

What MIX_ENV do you get the warnings in (all of them?)

all env

what phoenix version?

Have you tried deleting your _build directory and compiling it again? I ask this because I often get this warning when changing a route or updating dependencies. Here are the steps I follow when I start getting errors/warnings and everything looks like it should be working fine.

1 Like

I wish I knew exactly what I did to fix this, but it it working correctly now. I updated to phoenix_live_view 18.18(doubt that fixed anything). I suspect that @wceolin is on to the situation that was causing my problem. While I did not explicitly delete the _build directory, I made enough dependency changes that may have caused the offending mod to rebuild. I know that a mix compile --force did not fix the problem.

as @wceolin said, wiping out the _build and recompiling the deps sometimes is the best. Sounds like a build just got in a wonky state.