Shopify / Shopify/shopify-app-template-ruby
No interactive input to Rails server
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 154
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
Starting from this Ruby template with the Shopify CLI (shopify app init --template=ruby) and adding a debugger line to HomeController#index like so:
# frozen_string_literal: true
class HomeController < ApplicationController
include ShopifyApp::EmbeddedApp
include ShopifyApp::EnsureInstalled
include ShopifyApp::ShopAccessScopesVerification
DEV_INDEX_PATH = Rails.root.join("frontend")
PROD_INDEX_PATH = Rails.public_path.join("dist")
def index
if ShopifyAPI::Context.embedded? && (!params[:embedded].present? || params[:embedded] != "1")
redirect_to(ShopifyAPI::Auth.embedded_app_url(params[:host]), allow_other_host: true)
else
contents = File.read(File.join(Rails.env.production? ? PROD_INDEX_PATH : DEV_INDEX_PATH, "index.html"))
contents.sub!("%VITE_SHOPIFY_API_KEY%", ShopifyApp.configuration.api_key)
debugger
render(plain: contents, content_type: "text/html", layout: false)
end
end
end
Run shopify app dev and visit the app page. The Rails app pauses at the debugger line as expected, but there's absolutely no way to input anything - Shopify CLI seems to eat all input.
C:/Development/shopify_app_debugger_example/app-debugger-example/web/app/controllers/home_controller.rb
16:58:54 │ web-backend │ 12| if ShopifyAPI::Context.embedded? && (!params[:embedded].present? || params[:embedded] != "1")
16:58:54 │ web-backend │ 13| redirect_to(ShopifyAPI::Auth.embedded_app_url(params[:host]), allow_other_host: true)
16:58:54 │ web-backend │ 14| else
16:58:54 │ web-backend │ 15| contents = File.read(File.join(Rails.env.production? ? PROD_INDEX_PATH : DEV_INDEX_PATH,
"index.html"))
16:58:54 │ web-backend │ 16| contents.sub!("%VITE_SHOPIFY_API_KEY%", ShopifyApp.configuration.api_key)
16:58:54 │ web-backend │ => 17| debugger
16:58:54 │ web-backend │ 18| render(plain: contents, content_type: "text/html", layout: false)
16:58:54 │ web-backend │ 19| end
16:58:54 │ web-backend │ 20| end
16:58:54 │ web-backend │ 21| end
16:58:54 │ web-backend │ =>#0 HomeController#index at
C:/Development/shopify_app_debugger_example/app-debugger-example/web/app/controllers/home_controller.rb:17
16:58:54 │ web-backend │ #1 ActionController::BasicImplicitRender#send_action(method="index", args=[]) at
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/actionpack-7.1.6/lib/action_controller/metal/basic_implicit_render.rb:6
16:58:54 │ web-backend │ # and 85 frames (use `bt' command for all frames)
16:58:54 │ web-backend │ (rdbg)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ (d) Dev status │ (a) App info │ (s) Store info │ (q) Quit
✅ Ready, watching for changes in your app
› (g) Open GraphiQL (Admin API) in your browser
› (p) Preview in your browser
Preview URL: ***
GraphiQL URL: ***
pry, byebug, and debugger are all commonly used gems for debugging Rails apps so this feels like a big issue out of the box. Can the template be fixed to make input possible? If not, could the README or wiki include detailed instructions on a potential workaround?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the pause from app/controllers/home_controller.rb by running shopify app dev with debugger in HomeController#index. Start by checking how the CLI handles terminal input while the Rails process is paused, then determine whether the template or documentation owns the fix. Done means debugger commands can be entered, or a tested workaround is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- cli, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100