We've moved discussions to Discord

Heroku: 500 error on new application with app.json

Roeland Moors
I deployed a new application to heroku with app.json and get the error below.
(the website is showing a 500 error but the errors in heroku are blue instead of red)
Do I need an extra build step? Maybe caused by the new bundling packages?
2021-09-26T08:17:00.561570+00:00 app[web.1]: I, [2021-09-26T08:17:00.561490 #4]  INFO -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267] Started GET "/" for 84.193.175.197 at 2021-09-26 08:17:00 +0000
2021-09-26T08:17:00.563004+00:00 app[web.1]: I, [2021-09-26T08:17:00.562945 #4]  INFO -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267] Processing by StaticController#index as HTML
2021-09-26T08:17:00.564160+00:00 app[web.1]: D, [2021-09-26T08:17:00.564119 #4] DEBUG -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267]   Rendering layout layouts/application.html.erb
2021-09-26T08:17:00.564218+00:00 app[web.1]: D, [2021-09-26T08:17:00.564194 #4] DEBUG -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267]   Rendering static/index.html.erb within layouts/application
2021-09-26T08:17:00.564317+00:00 app[web.1]: I, [2021-09-26T08:17:00.564293 #4]  INFO -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267]   Rendered static/index.html.erb within layouts/application (Duration: 0.0ms | Allocations: 4)
2021-09-26T08:17:00.565119+00:00 app[web.1]: I, [2021-09-26T08:17:00.565080 #4]  INFO -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267]   Rendered layout layouts/application.html.erb (Duration: 0.9ms | Allocations: 300)
2021-09-26T08:17:00.565323+00:00 app[web.1]: I, [2021-09-26T08:17:00.565293 #4]  INFO -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267] Completed 500 Internal Server Error in 2ms (Allocations: 795)
2021-09-26T08:17:00.566286+00:00 app[web.1]: F, [2021-09-26T08:17:00.566251 #4] FATAL -- : [3c0d9bbf-cc86-4647-859c-82e3338b3267]   
2021-09-26T08:17:00.566286+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267] ActionView::Template::Error (The asset "application.js" is not present in the asset pipeline.
2021-09-26T08:17:00.566287+00:00 app[web.1]: ):
2021-09-26T08:17:00.566287+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     12:     <%= csp_meta_tag %>
2021-09-26T08:17:00.566288+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     13:     <meta name="viewport" content="width=device-width, initial-scale=1">
2021-09-26T08:17:00.566288+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     14: 
2021-09-26T08:17:00.566288+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     15:     <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
2021-09-26T08:17:00.566289+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     16:     <%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %>
2021-09-26T08:17:00.566289+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     17: 
2021-09-26T08:17:00.566289+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]     18:     <%# Be sure to add your own custom favicons %>
2021-09-26T08:17:00.566289+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267]   
2021-09-26T08:17:00.566290+00:00 app[web.1]: [3c0d9bbf-cc86-4647-859c-82e3338b3267] app/views/layouts/application.html.erb:15


Roeland Moors
I added the node buildpack like explained here: https://github.com/jumpstart-pro/jumpstart-pro/issues/67
Now it works.
Franck PATTE
Hello there,
I have the same kind of issue.
I did a fresh install and deployed on Heroku,
I got a 500 error, Heroku logs says:
The asset "application.js" is not present in the asset pipeline
I tried your solution by changing app.json and pushing again to Heroku
-- "buildpacks": [{ "url": "heroku/ruby" }],
++"buildpacks": [{ "url": "heroku/nodejs" }, { "url": "heroku/ruby" }],

I'm stuck,
what did I miss?  is it the same error/issue?


HEROKU LOGS
2021-09-28T07:53:26.434719+00:00 app[web.1]: F, [2021-09-28T07:53:26.434680 #4] FATAL -- : [b193dab0-0287-4384-933a-d47c52e36395]
2021-09-28T07:53:26.434720+00:00 app[web.1]: [b193dab0-0287-4384-933a-d47c52e36395] ActionView::Template::Error (The asset "application.js" is not present in the asset pipeline.

Franck PATTE
I did add the Webpack heroku/nodejs directly from the Heroku dashboard
it works !
still wondering while it didn't work with app.json
 
Roeland Moors
I think app.json is only used with a fresh deploy to heroku, the first setup: https://devcenter.heroku.com/articles/setting-up-apps-using-the-heroku-platform-api 
Will Read
I ran in to this too. Feels like the app.js should be changed so that the first deploy picks up the nodejs buildpack, no?
Will Read
Looks like Chris Oliver fixed this 19 days ago.
Chris Oliver
Heroku is able to add heroku/nodejs buildpack automatically with webpacker, but not with jsbundling so you have to go back to adding the buildpack yourself now.

They're considering fixing that, but not yet. Oh heroku.
Notifications
You’re not receiving notifications from this thread.