Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot recompile static files due to phoenix don't match plug/static.ex on serve_static #2413

Closed
equivalent opened this issue Jul 28, 2017 · 3 comments

Comments

@equivalent
Copy link

equivalent commented Jul 28, 2017

Hi I am running Phoenix 1.3 on edge (from master). I've rebuild my Docker image (reputed master) and since then I'm getting:

[error] #PID<0.584.0> running Eq8.Web.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /css/app.css
** (exit) an exception was raised:
    ** (Protocol.UndefinedError) protocol String.Chars not implemented for %{at: [], brotli?: false, et_cache: "public", et_generation: nil, from: {:eq8_web, "priv/static"}, gzip?: false, headers: %{}, only: ["css", "fonts", "images", "js", "favicon.ico", "robots.txt"], prefix: [], qs_cache: "public, max-age=31536000"}
        (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
        (elixir) lib/string/chars.ex:17: String.Chars.to_string/1
        (elixir) lib/io.ex:533: IO.puts/2
        (plug) lib/plug/static.ex:195: Plug.Static.serve_static/4
        (eq8_web) lib/eq8_web/endpoint.ex:1: Eq8.Web.Endpoint.plug_builder_call/2
        (eq8_web) lib/plug/debugger.ex:123: Eq8.Web.Endpoint."call (overridable 3)"/2
        (eq8_web) lib/eq8_web/endpoint.ex:1: Eq8.Web.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) /app/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
[error] #PID<0.586.0> running Eq8.Web.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /js/app.js
** (exit) an exception was raised:
    ** (Protocol.UndefinedError) protocol String.Chars not implemented for %{at: [], brotli?: false, et_cache: "public", et_generation: nil, from: {:eq8_web, "priv/static"}, gzip?: false, headers: %{}, only: ["css", "fonts", "images", "js", "favicon.ico", "robots.txt"], prefix: [], qs_cache: "public, max-age=31536000"}
        (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
        (elixir) lib/string/chars.ex:17: String.Chars.to_string/1
        (elixir) lib/io.ex:533: IO.puts/2
        (plug) lib/plug/static.ex:195: Plug.Static.serve_static/4
        (eq8_web) lib/eq8_web/endpoint.ex:1: Eq8.Web.Endpoint.plug_builder_call/2
        (eq8_web) lib/plug/debugger.ex:123: Eq8.Web.Endpoint."call (overridable 3)"/2
        (eq8_web) lib/eq8_web/endpoint.ex:1: Eq8.Web.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) /app/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

it seems that what is phoenix sending to static recompilation

%{at: [], brotli?: false, et_cache: "public", et_generation: nil,
  from: {:eq8_web, "priv/static"}, gzip?: false, headers: %{},
  only: ["css", "fonts", "images", "js", "favicon.ico", "robots.txt"],
  prefix: [], qs_cache: "public, max-age=31536000"}

doesnt match Plug.Static.serve_static

https://github.com/elixir-plug/plug/blob/master/lib/plug/static.ex#L193

It could be that my phoenix generated up don't match latest 1.3 rc (As I've generated umbrella app few weeks ago)

@equivalent equivalent changed the title static files generated by phoenix don't match plug/static.ex on serve_static cannot recompile static files due to phoenix don't match plug/static.ex on serve_static Jul 28, 2017
@josevalim
Copy link
Member

Can you please provide the template information? We also need to know your Elixir version as well as your Plug version.

I suspect what happened is that you recompiled Plug but you did not recompile your Phoenix app. If you remove the _build directory and start from scratch, it should all work.

@josevalim
Copy link
Member

Btw, we need to know your Plug version because the stacktrace you posted does not match the code in master. :)

@equivalent
Copy link
Author

All hail the Great Jose :) , ... yes you were right rm -rf ./_build and then recompiling deps (mix deps.get && mix phx.server) done the trick. Thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants