CORS Error

I created a Phoenix API (no ecto, no webpack, no html). Works great.

I needed to add CORS functionality to the API so that another URL can access the API.

mix.exs

  defp deps do
    [
      ...
      {:cors_plug, "~> 2.0"}
    ]
  end

router.ex

  pipeline :api do
    plug CORSPlug, origin: "*"
    plug CORSPlug, send_preflight_response?: false
    plug :accepts, ["json"]
  end

  scope "/api", AnalyticsApiWeb do
    pipe_through :api

    get "/chart/*path", AnalyticsController, :get_chart
    options "/chart/*path", AnalyticsController, :options
  end

CORS is working fine, but when the application is compiling/building, I get this error which only appeared when I added the above CORS code:

warning: incompatible types:

    map() !~ atom()

in expression:

    # lib/analytics_api_web/router.ex:1
    endpoint.static_url

where "endpoint" was given the type atom() in:

    # lib/analytics_api_web/router.ex:1
    is_atom(endpoint)

where "endpoint" was given the type map() (due to calling var.field) in:

    # lib/analytics_api_web/router.ex:1
    endpoint.static_url

HINT: "var.field" (without parentheses) implies "var" is a map() while "var.fun()" (with parentheses) implies "var" is an atom()

Conflict found at
  lib/analytics_api_web/router.ex:1: AnalyticsApiWeb.Router.Helpers.static_url/2

What did I do wrong?