stoiven
Hi there! I have deployed this (after forking) to Heroku, but for some reason, none of the assets are loading. I’m fairly new to the language and I have a feeling that maybe some environmental variable might be misconfigured or something?
The front page loads perfectly fine, but not as intended. I went to check the developer tools and realized that it was doing a GET call from localhost, which I don’t believe is right?
GET http://localhost:43751/css/app-b358ab485f4965187a0366829058b5e7.css?vsn=d net::ERR_CONNECTION_REFUSED
GET http://localhost:43751/js/app-47ffdb6029e02e02cf2f5c4f4e2c7e4e.js?vsn=d net::ERR_CONNECTION_REFUSED
localhost:43751/images/til-logo-144x144-866373717b4dc8f05b886baaf7abae3b.png?vsn=d:1
GET http://localhost:43751/images/til-logo-144x144-866373717b4dc8f05b886baaf7abae3b.png?vsn=d net::ERR_CONNECTION_REFUSED
Error while trying to use the following icon from the Manifest: http://localhost:43751/images/til-logo-144x144-866373717b4dc8f05b886baaf7abae3b.png?vsn=d (Download error or resource isn't a valid image)
Not sure if the config needs to be changed here: tilex/config/config.exs at master · hashrocket/tilex · GitHub since this is where I find localhost only existing or if it needs to be added to the Heroku config vars, but I have inputted in the SECRET_KEY_BASE on Heroku.
The dyno is using: web MIX_ENV=prod mix phx.server and made sure it’s pointing to my app.
Sorry if I’m not providing all the information needed, so please let me know if I’m missing something.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
wmnnd
Hey there!
Just a quick note: Usually people prefer building a Release first and deploying that instead of installing Elixir and mix and then using
mix phx.server. Check out the docs on Releases here:https://elixir-lang.org/getting-started/mix-otp/config-and-releases.html
To address your immediate issue, did you make sure to a) install and build your assets (
npm run deploy --prefix ./assets) and b) compile your assets withmix phx.digest?I also recommend you take a look at the Deployment Guide from Phoenix:
In case the issue is actually related to the generation of absolute URLs: You might have to change the URL configuration from
to something like
(see Phoenix.Endpoint — Phoenix v1.8.8)
stoiven
Thanks for a quick response! I’ll definitely check out the docs you mentioned and I guess I just got too hasty with deploying
I went and a
heroku runon it and refreshed the page and the end result was still the same. I also changed localhost to point to the Heroku project as well to no avail. What I’ve noticed comparing my app to original project is that (checking the Sources via developer tools here) the scripts load (e.g. analytics.js, app.js, etc.) but my project doesn’t contain that. The main thing I see under sources are just an index file that’s still somehow referencinglocalhostand amanifest.jsonfile.al2o3cr
The
prodconfig expects to find the host’s name in aHOSTenvironment variable, are you setting that in your Heroku config?stoiven
Yep! I’ve replaced
HOSTwith my Heroku app url. The issue is just that none of html/css files load properlyaxelson
What buildpack are you using (and what version of it)? It sounds like you might be missing GitHub - gjaldon/heroku-buildpack-phoenix-static: A Heroku buildpack for building Phoenix's static assets · GitHub which is usually used in addition to GitHub - HashNuke/heroku-buildpack-elixir: Heroku Buildpack for Elixir with nitro boost · GitHub
stoiven
I’m not entirely sure what versions they are specifically, but from here tilex/app.json at master · hashrocket/tilex · GitHub I had copy-pasted those to URLs to Heroku buildpack config so I assume that’s right?
stoiven
Just for note, this is the Heroku app I’m trying to work with: https://stoiven-til.herokuapp.com/
axelson
Hmm, the assets such as the CSS are loading fine for me and if you are using those buildpacks should be good. This is what I see on that site:
stoiven
Yea! I ended up getting it working this morning so what timing hah.
I had to add the URL under here
Which I’m not entirely sure why yet. On the other hand, still running into another issue (well I guess this is different from the main issue, so maybe might need to make another post?)
The permalink and raw buttons don’t work for posts. One leads to an error page and the other leads to a crashed site (spouting
HTTP ERROR 500), respectively. Not sure why the edit works fine tho (as an admin) and as well as the channel.I’m looking at the heroku logs and getting this when hitting
permalink:And this for
rawI did
mix phx.routesand it seems like everything is put in place? Not sure why it’s not working.axelson
Generally I would probably write this something more like:
But calling
Map.from_structon a%URI{}seems highly atypical. Usually I would callto_stringon the%URI{}to get out a plan URL (e.g."https://stoiven-til.herokuapp.com"), but if you wanted that in this case you would not even needURI.parseunless you’re using it for validation. Can you show how you’re usingstatic_url?For the other issues I think you should post a new topic, and make sure to include the implementation of the controllers (along with the exceptions).