0
votes

very new with ruby on rails. Apologize in advance for the somewhat obvious nature of this question.

I have a new rails app and I have included the shopify_app gem in my Gemfile. When trying to get the app up and running I am receiving the following error.

uninitialized constant ShopifyApp : in the following segment of code is where the error is occurring.

Rails.application.routes.draw do
  root :to => 'home#index'
  mount ShopifyApp::Engine, at: '/'  # this is the line throwing the error 

end

My question is , what could cause this error to be thrown? I believe this was installed when i ran bundle install ( with the shopify_app gem in the Gemfile) Please let me know if you need additional information. Any point in the right direction would be helpful for me. Thanks.

Here is the full trace associated with it as well.

config/routes.rb:3:in `block in <top (required)>'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:436:in `instance_exec'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:436:in `eval_block'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:418:in `draw'
config/routes.rb:1:in `<top (required)>'
railties (5.1.6) lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
railties (5.1.6) lib/rails/application/routes_reloader.rb:55:in `each'
railties (5.1.6) lib/rails/application/routes_reloader.rb:55:in `load_paths'
railties (5.1.6) lib/rails/application/routes_reloader.rb:18:in `reload!'
railties (5.1.6) lib/rails/application/routes_reloader.rb:41:in `block in updater'
activesupport (5.1.6) lib/active_support/file_update_checker.rb:81:in `execute'
railties (5.1.6) lib/rails/application/routes_reloader.rb:25:in `execute'
railties (5.1.6) lib/rails/application/finisher.rb:141:in `block (2 levels) in <module:Finisher>'
activesupport (5.1.6) lib/active_support/callbacks.rb:413:in `instance_exec'
activesupport (5.1.6) lib/active_support/callbacks.rb:413:in `block in make_lambda'
activesupport (5.1.6) lib/active_support/callbacks.rb:197:in `block (2 levels) in halting'
activesupport (5.1.6) lib/active_support/callbacks.rb:601:in `block (2 levels) in default_terminator'
activesupport (5.1.6) lib/active_support/callbacks.rb:600:in `catch'
activesupport (5.1.6) lib/active_support/callbacks.rb:600:in `block in default_terminator'
activesupport (5.1.6) lib/active_support/callbacks.rb:198:in `block in halting'
activesupport (5.1.6) lib/active_support/callbacks.rb:507:in `block in invoke_before'
activesupport (5.1.6) lib/active_support/callbacks.rb:507:in `each'
activesupport (5.1.6) lib/active_support/callbacks.rb:507:in `invoke_before'
activesupport (5.1.6) lib/active_support/callbacks.rb:130:in `run_callbacks'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:108:in `run!'
activesupport (5.1.6) lib/active_support/reloader.rb:113:in `run!'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:70:in `block in run!'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:67:in `tap'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:67:in `run!'
activesupport (5.1.6) lib/active_support/reloader.rb:59:in `run!'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:10:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.6.0) lib/web_console/middleware.rb:137:in `call_app'
web-console (3.6.0) lib/web_console/middleware.rb:22:in `block in call'
web-console (3.6.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.4) lib/rack/method_override.rb:22:in `call'
rack (2.0.4) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.4) lib/rack/sendfile.rb:111:in `call'
railties (5.1.6) lib/rails/engine.rb:522:in `call'
puma (3.11.3) lib/puma/configuration.rb:225:in `call'
puma (3.11.3) lib/puma/server.rb:624:in `handle_request'
puma (3.11.3) lib/puma/server.rb:438:in `process_client'
puma (3.11.3) lib/puma/server.rb:302:in `block in run'
puma (3.11.3) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
This error occurred while loading the following files:

Gemfile:

    source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Shopify App Gem - should include Shopify API as well
gem 'shopify_app'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
1
can you please post your Gemfile too? It is possible that you add shopify gem in wrong group such as test or productionmdegis
Did you follow the official documentation for installing? InstallRcordoval

1 Answers

0
votes

It looks like you want to leave off at: '/'. You would only specify a NESTED route, one that wasn't / (root). You just want to mount in the root. As you can see here, it's going to create a bunch of routes for you.

https://github.com/Shopify/shopify_app#mounting-the-engine

Mounting the Engine will provide the basic routes to authenticating a shop with your application. By default it will provide:

Verb    Route   Action
GET '/login'    Login
POST    '/login'    Login
GET '/auth/shopify/callback'    Authenticate Callback
GET '/logout'   Logout
POST    '/webhooks/:type'   Webhook Callback