mercredi 22 avril 2020

Phoenix: Error when refer to exq_ui dependency via git

I use exq and exq_ui for background job processing and monitoring in my Phoenix application.

At first, I refer to exq_ui in mix.exs's deps like this:

{:exq_ui, "~> 0.11.0", only: [:dev, :qa, :stg, :prod]}

And it works fine.

But then I discover 2 bugs in the UI:

  • When I click on the tab Busy, it blows up on the server side, and show nothing in the tab Busy in UI.
  • In the tab Scheduled, when a job is passed args as a list of map, it is showed as [Object object] in the column Args, instead of the real content of the args.

I fix those bugs here in this PR to thee main official repo: https://github.com/akira/exq_ui/pull/89/files

But I cannot expect it will be merged anytime soon, so I change my dependency in mix.exs like this:

{:exq_ui, "~> 0.11.0",
  git: "https://github.com/chauhonglinh/exq_ui.git",
  branch: "feature/fix_busy_tab_in_exq_ui",
  only: [:dev, :qa, :stg, :prod]}

Now the trouble happens.

The mix deps.get, mix deps.compile and iex -S mix phx.server all run successfully.

But then when I browse to http://localhost:4040, the UI doesn't show up, and in the javascript console, there are errors:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:4040/assets/vendor.css".
exq_ui:20 
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:4040/assets/exqui.css".
vendor.js:1 Uncaught SyntaxError: Unexpected token <
exqui.js:1 Uncaught SyntaxError: Unexpected token <

Question: Why did this error not happen with ordinary deps config, but it happened with deps config referred to a git repo?

How can I fix it?

I think React and Angular also have similar errors in certain situations, but it seems that nobody has a good fix for them, just some anecdotes here and there.




Aucun commentaire:

Enregistrer un commentaire