'Heroku Routing Issue 304 Issue
I am getting a routing error in my Heroku app that I created in React.Js. I can see the home page (https://sweat-stax.herokuapp.com/) but I can't seem to visit any of the other pages. I believe it is something to do with my routes but I have done everything as I've done in previous projects.
Here is my routes.rb page:
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
Here are the gems I added as suggested (just a segment of my Gemfile):
gem "net-smtp", require: false
gem 'net-pop', require: false
gem 'net-imap', require: false
I didn't delete the package-lock as I didn't want to go through everything all over again and read that it wasn't good practice.
And here is my package-json file:
{
"devDependencies": {
"webpack": "^5.70.0"
},
"dependencies": {
"ionic-native": "https://github.com/ionic-team/ionic-native/tarball/v3.5.0",
"materialize-css": "^1.0.0-rc.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-materialize": "^3.10.0",
"styled-components": "^5.3.5"
},
"name": "sweatstax",
"description": "This README would normally document whatever steps are necessary to get the application up and running.",
"version": "1.0.0",
"main": "index.js",
"directories": {
"lib": "lib",
"test": "test"
},
"engines": {
"node": "16.14.2",
"npm": "8.5.0"
},
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "cd client && npm install --only=dev && npm install && npm run build && cd ..",
"deploy": "cp -a client/build/. public/",
"heroku-postbuild": "npm run build && npm run deploy && echo 'Client Built'"
},
"repository": {
"type": "git",
"url": "git+https://github.com/smedlin13/SweatStax.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/smedlin13/SweatStax/issues"
},
"homepage": "https://github.com/smedlin13/SweatStax#readme"
}
And my Procfile:
web bin/rails server -p ${PORT:-5000} -e $RAILS_ENV
I'm not really getting an error code in the Heroku Logs as it's up and running, I just get this when I try to visit another page:
2022-04-21T19:36:47.765505+00:00 heroku[router]: at=info method=GET path="/register" host=sweat-stax.herokuapp.com request_id=188656e8-3072-4314-8293-4e74163b845a fwd="104.10.51.24" dyno=web.1 connect=0ms service=3ms status=304 bytes=431 protocol=https
2022-04-21T19:36:47.765732+00:00 app[web.1]: I, [2022-04-21T19:36:47.765672 #4] INFO -- : [188656e8-3072-4314-8293-4e74163b845a] Started GET "/register" for 104.10.51.24 at 2022-04-21 19:36:47 +0000
2022-04-21T19:36:47.766686+00:00 app[web.1]: I, [2022-04-21T19:36:47.766638 #4] INFO -- : [188656e8-3072-4314-8293-4e74163b845a] Processing by StaticController#index as HTML
2022-04-21T19:36:47.766710+00:00 app[web.1]: I, [2022-04-21T19:36:47.766687 #4] INFO -- : [188656e8-3072-4314-8293-4e74163b845a] Parameters: {"other"=>"register"}
2022-04-21T19:36:47.767095+00:00 app[web.1]: I, [2022-04-21T19:36:47.767067 #4] INFO -- : [188656e8-3072-4314-8293-4e74163b845a] Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 145)
Any help is appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
