'Error: Unable to load application: NameError: undefined local variable or method `controller_path' for Object:Class - When pushing to Heroku
beginner here learning how to push a project to production. I am pushing my ReactJS app that has a server side and client side to Heroku and have the following error code that leads to it crashing on Heroku:
2022-05-06T14:51:18.301196+00:00 heroku[web.1]: State changed from crashed to starting
2022-05-06T14:51:26.595277+00:00 heroku[web.1]: Starting process with command `bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}`
2022-05-06T14:51:27.963617+00:00 app[web.1]: Puma starting in single mode...
2022-05-06T14:51:27.963633+00:00 app[web.1]: * Puma version: 5.6.2 (ruby 3.1.1-p18) ("Birdie's Version")
2022-05-06T14:51:27.963634+00:00 app[web.1]: * Min threads: 5
2022-05-06T14:51:27.963634+00:00 app[web.1]: * Max threads: 5
2022-05-06T14:51:27.963635+00:00 app[web.1]: * Environment: production
2022-05-06T14:51:27.963637+00:00 app[web.1]: * PID: 4
2022-05-06T14:51:30.556016+00:00 app[web.1]: ! Unable to load application: NameError: undefined local variable or method `controller_path' for Object:Class
2022-05-06T14:51:30.556031+00:00 app[web.1]:
2022-05-06T14:51:30.556032+00:00 app[web.1]: controller_path
2022-05-06T14:51:30.556033+00:00 app[web.1]: ^^^^^^^^^^^^^^^
2022-05-06T14:51:30.556170+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/3.1.0/bin/puma)
I have added in authentication with this app using the Devise token and have added in a static controller to my routes:
require 'rails/application_controller'
class StaticController < Rails::ApplicationController
layout false
def index
render file: Rails.root.join('public', 'index.html')
end
end
Here is my routes:
Rails.application.routes.draw do
mount_devise_token_auth_for 'User', at: 'api/auth'
namespace :api do
resources :users, only: :update
resources :workouts
end
get '*other', to: 'static#index'
end
Any ideas why this error code is showing up and how I can fix it? Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|