Skip to content

Commit dc55029

Browse files
committed
Fix loading issues with modern rails versions
The jobs used here are referenced in custom ActiveJob serializers in other apps (specifically, merchant-to-merchant). Due to how they were being included and loaded here and some changes in Rails 8.1 (registering custom serializers earlier), those serializers were not being properly registered. Updating to a more modern version of rails and allow rails to handle to load paths fixed the problem. It's worth saying here: rails maintainers do not intend for you to load things like ActiveRecord::Base or ActiveJob::Base during initialization. Doing so is not a good practice and may result in unitended bugs / side effects. Add development dependencies for updated versions: Starting with Ruby 3.4, CSV (along with other libraries like mutex_m, base64, bigdecimal, and drb) has been completely removed from the standard library and must be explicitly added as a gem dependency. When you use require "rails/all" in your test dummy app (test/dummy/config/application.rb:5), Rails loads various components that may depend on CSV for functionality like CSV export features in ActiveRecord.
1 parent 551948c commit dc55029

File tree

8 files changed

+135
-92
lines changed

8 files changed

+135
-92
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: Ruby ${{ matrix.version }}
1313
strategy:
1414
matrix:
15-
version: ['3.1', '3.2', '3.3']
15+
version: ['3.2', '3.3', '3.4']
1616

1717
steps:
1818
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Unreleased
22
----------
3+
- ⚠️ [Breaking] Bumps minimum supported Rails version to 7.1 & Ruby version to 3.2; moves jobs from `lib` to `app` to fix loading issues with modern rails versions. [#2020](https://github.com/Shopify/shopify_app/pull/2020)
34
- ⚠️ [Breaking] Removes `ShopifyApp::JWTMiddleware` and `ShopifyApp::JWT` See [Upgrading](/docs/Upgrading.md) for more migration. [1960](https://github.com/Shopify/shopify_app/pull/1960)
45
- ⚠️ [Breaking] Removed deprecated `CallbackController` methods. `perform_after_authenticate_job`, `install_webhooks`, and `perform_post_authenticate_jobs` have been removed. [#1961](https://github.com/Shopify/shopify_app/pull/1961)
56
- ⚠️ [Breaking] Bumps minimum supported Ruby version to 3.1 [#1959](https://github.com/Shopify/shopify_app/pull/1959)

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source "https://rubygems.org"
66
gemspec
77

88
gem "rails-controller-testing", group: :test
9-
gem "rails", "< 7" # temporary: https://github.com/Shopify/shopify_app/pull/1561
9+
gem "rails"
1010

1111
group :rubocop do
1212
gem "rubocop-shopify", require: false

Gemfile.lock

Lines changed: 127 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,105 @@ PATH
33
specs:
44
shopify_app (22.5.2)
55
addressable (~> 2.7)
6-
rails (> 5.2.1)
6+
rails (> 7)
77
redirect_safely (~> 1.0)
88
shopify_api (>= 14.7.0, < 15.0)
99

1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
actioncable (6.1.7.9)
14-
actionpack (= 6.1.7.9)
15-
activesupport (= 6.1.7.9)
13+
actioncable (8.0.0)
14+
actionpack (= 8.0.0)
15+
activesupport (= 8.0.0)
1616
nio4r (~> 2.0)
1717
websocket-driver (>= 0.6.1)
18-
actionmailbox (6.1.7.9)
19-
actionpack (= 6.1.7.9)
20-
activejob (= 6.1.7.9)
21-
activerecord (= 6.1.7.9)
22-
activestorage (= 6.1.7.9)
23-
activesupport (= 6.1.7.9)
24-
mail (>= 2.7.1)
25-
actionmailer (6.1.7.9)
26-
actionpack (= 6.1.7.9)
27-
actionview (= 6.1.7.9)
28-
activejob (= 6.1.7.9)
29-
activesupport (= 6.1.7.9)
30-
mail (~> 2.5, >= 2.5.4)
31-
rails-dom-testing (~> 2.0)
32-
actionpack (6.1.7.9)
33-
actionview (= 6.1.7.9)
34-
activesupport (= 6.1.7.9)
35-
rack (~> 2.0, >= 2.0.9)
18+
zeitwerk (~> 2.6)
19+
actionmailbox (8.0.0)
20+
actionpack (= 8.0.0)
21+
activejob (= 8.0.0)
22+
activerecord (= 8.0.0)
23+
activestorage (= 8.0.0)
24+
activesupport (= 8.0.0)
25+
mail (>= 2.8.0)
26+
actionmailer (8.0.0)
27+
actionpack (= 8.0.0)
28+
actionview (= 8.0.0)
29+
activejob (= 8.0.0)
30+
activesupport (= 8.0.0)
31+
mail (>= 2.8.0)
32+
rails-dom-testing (~> 2.2)
33+
actionpack (8.0.0)
34+
actionview (= 8.0.0)
35+
activesupport (= 8.0.0)
36+
nokogiri (>= 1.8.5)
37+
rack (>= 2.2.4)
38+
rack-session (>= 1.0.1)
3639
rack-test (>= 0.6.3)
37-
rails-dom-testing (~> 2.0)
38-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
39-
actiontext (6.1.7.9)
40-
actionpack (= 6.1.7.9)
41-
activerecord (= 6.1.7.9)
42-
activestorage (= 6.1.7.9)
43-
activesupport (= 6.1.7.9)
40+
rails-dom-testing (~> 2.2)
41+
rails-html-sanitizer (~> 1.6)
42+
useragent (~> 0.16)
43+
actiontext (8.0.0)
44+
actionpack (= 8.0.0)
45+
activerecord (= 8.0.0)
46+
activestorage (= 8.0.0)
47+
activesupport (= 8.0.0)
48+
globalid (>= 0.6.0)
4449
nokogiri (>= 1.8.5)
45-
actionview (6.1.7.9)
46-
activesupport (= 6.1.7.9)
50+
actionview (8.0.0)
51+
activesupport (= 8.0.0)
4752
builder (~> 3.1)
48-
erubi (~> 1.4)
49-
rails-dom-testing (~> 2.0)
50-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
51-
activejob (6.1.7.9)
52-
activesupport (= 6.1.7.9)
53+
erubi (~> 1.11)
54+
rails-dom-testing (~> 2.2)
55+
rails-html-sanitizer (~> 1.6)
56+
activejob (8.0.0)
57+
activesupport (= 8.0.0)
5358
globalid (>= 0.3.6)
54-
activemodel (6.1.7.9)
55-
activesupport (= 6.1.7.9)
56-
activerecord (6.1.7.9)
57-
activemodel (= 6.1.7.9)
58-
activesupport (= 6.1.7.9)
59-
activestorage (6.1.7.9)
60-
actionpack (= 6.1.7.9)
61-
activejob (= 6.1.7.9)
62-
activerecord (= 6.1.7.9)
63-
activesupport (= 6.1.7.9)
59+
activemodel (8.0.0)
60+
activesupport (= 8.0.0)
61+
activerecord (8.0.0)
62+
activemodel (= 8.0.0)
63+
activesupport (= 8.0.0)
64+
timeout (>= 0.4.0)
65+
activestorage (8.0.0)
66+
actionpack (= 8.0.0)
67+
activejob (= 8.0.0)
68+
activerecord (= 8.0.0)
69+
activesupport (= 8.0.0)
6470
marcel (~> 1.0)
65-
mini_mime (>= 1.1.0)
66-
activesupport (6.1.7.9)
67-
concurrent-ruby (~> 1.0, >= 1.0.2)
71+
activesupport (8.0.0)
72+
base64
73+
benchmark (>= 0.3)
74+
bigdecimal
75+
concurrent-ruby (~> 1.0, >= 1.3.1)
76+
connection_pool (>= 2.2.5)
77+
drb
6878
i18n (>= 1.6, < 2)
79+
logger (>= 1.4.2)
6980
minitest (>= 5.1)
70-
tzinfo (~> 2.0)
71-
zeitwerk (~> 2.3)
81+
securerandom (>= 0.3)
82+
tzinfo (~> 2.0, >= 2.0.5)
83+
uri (>= 0.13.1)
7284
addressable (2.8.4)
7385
public_suffix (>= 2.0.2, < 6.0)
7486
ast (2.4.2)
87+
base64 (0.3.0)
88+
benchmark (0.5.0)
89+
bigdecimal (3.3.1)
7590
binding_of_caller (1.0.0)
7691
debug_inspector (>= 0.0.1)
7792
builder (3.3.0)
7893
byebug (11.1.3)
7994
coderay (1.1.3)
8095
concurrent-ruby (1.3.4)
96+
connection_pool (2.5.4)
8197
crack (0.4.5)
8298
rexml
8399
crass (1.0.6)
100+
csv (3.3.5)
84101
date (3.4.1)
85102
debug_inspector (1.1.0)
103+
drb (2.2.3)
104+
erb (5.1.1)
86105
erubi (1.13.0)
87106
globalid (1.2.1)
88107
activesupport (>= 6.1)
@@ -93,9 +112,15 @@ GEM
93112
multi_xml (>= 0.5.2)
94113
i18n (1.14.6)
95114
concurrent-ruby (~> 1.0)
115+
io-console (0.8.1)
116+
irb (1.15.2)
117+
pp (>= 0.6.0)
118+
rdoc (>= 4.0.0)
119+
reline (>= 0.4.2)
96120
json (2.7.2)
97121
jwt (2.7.0)
98122
language_server-protocol (3.17.0.3)
123+
logger (1.7.0)
99124
loofah (2.23.1)
100125
crass (~> 1.0.2)
101126
nokogiri (>= 1.12.0)
@@ -111,6 +136,7 @@ GEM
111136
mocha (2.0.2)
112137
ruby2_keywords (>= 0.0.5)
113138
multi_xml (0.6.0)
139+
mutex_m (0.3.0)
114140
net-imap (0.4.20)
115141
date
116142
net-protocol
@@ -133,7 +159,10 @@ GEM
133159
parser (3.3.0.5)
134160
ast (~> 2.4.1)
135161
racc
162+
pp (0.6.3)
163+
prettyprint
136164
prettier_print (1.2.1)
165+
prettyprint (0.2.0)
137166
pry (0.14.2)
138167
coderay (~> 1.1)
139168
method_source (~> 1.0)
@@ -142,26 +171,33 @@ GEM
142171
pry-stack_explorer (0.6.1)
143172
binding_of_caller (~> 1.0)
144173
pry (~> 0.13)
174+
psych (5.2.6)
175+
date
176+
stringio
145177
public_suffix (5.0.1)
146178
racc (1.8.1)
147179
rack (2.2.14)
180+
rack-session (1.0.2)
181+
rack (< 3)
148182
rack-test (2.1.0)
149183
rack (>= 1.3)
150-
rails (6.1.7.9)
151-
actioncable (= 6.1.7.9)
152-
actionmailbox (= 6.1.7.9)
153-
actionmailer (= 6.1.7.9)
154-
actionpack (= 6.1.7.9)
155-
actiontext (= 6.1.7.9)
156-
actionview (= 6.1.7.9)
157-
activejob (= 6.1.7.9)
158-
activemodel (= 6.1.7.9)
159-
activerecord (= 6.1.7.9)
160-
activestorage (= 6.1.7.9)
161-
activesupport (= 6.1.7.9)
184+
rackup (1.0.1)
185+
rack (< 3)
186+
webrick
187+
rails (8.0.0)
188+
actioncable (= 8.0.0)
189+
actionmailbox (= 8.0.0)
190+
actionmailer (= 8.0.0)
191+
actionpack (= 8.0.0)
192+
actiontext (= 8.0.0)
193+
actionview (= 8.0.0)
194+
activejob (= 8.0.0)
195+
activemodel (= 8.0.0)
196+
activerecord (= 8.0.0)
197+
activestorage (= 8.0.0)
198+
activesupport (= 8.0.0)
162199
bundler (>= 1.15.0)
163-
railties (= 6.1.7.9)
164-
sprockets-rails (>= 2.0.0)
200+
railties (= 8.0.0)
165201
rails-controller-testing (1.0.5)
166202
actionpack (>= 5.0.1.rc1)
167203
actionview (>= 5.0.1.rc1)
@@ -173,18 +209,26 @@ GEM
173209
rails-html-sanitizer (1.6.1)
174210
loofah (~> 2.21)
175211
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
176-
railties (6.1.7.9)
177-
actionpack (= 6.1.7.9)
178-
activesupport (= 6.1.7.9)
179-
method_source
212+
railties (8.0.0)
213+
actionpack (= 8.0.0)
214+
activesupport (= 8.0.0)
215+
irb (~> 1.13)
216+
rackup (>= 1.0.0)
180217
rake (>= 12.2)
181-
thor (~> 1.0)
218+
thor (~> 1.0, >= 1.2.2)
219+
zeitwerk (~> 2.6)
182220
rainbow (3.1.1)
183221
rake (13.0.6)
184222
rb-readline (0.5.5)
223+
rdoc (6.15.0)
224+
erb
225+
psych (>= 4.0.0)
226+
tsort
185227
redirect_safely (1.0.0)
186228
activemodel
187229
regexp_parser (2.9.0)
230+
reline (0.6.2)
231+
io-console (~> 0.5)
188232
rexml (3.3.9)
189233
rubocop (1.62.1)
190234
json (~> 2.3)
@@ -207,7 +251,7 @@ GEM
207251
syntax_tree (>= 6.1.1, < 7)
208252
ruby-progressbar (1.13.0)
209253
ruby2_keywords (0.0.5)
210-
securerandom (0.2.2)
254+
securerandom (0.4.1)
211255
shopify_api (14.7.0)
212256
activesupport
213257
concurrent-ruby
@@ -220,27 +264,25 @@ GEM
220264
sorbet-runtime
221265
zeitwerk (~> 2.5)
222266
sorbet-runtime (0.5.10835)
223-
sprockets (4.2.0)
224-
concurrent-ruby (~> 1.0)
225-
rack (>= 2.2.4, < 4)
226-
sprockets-rails (3.4.2)
227-
actionpack (>= 5.2)
228-
activesupport (>= 5.2)
229-
sprockets (>= 3.0.0)
230-
sqlite3 (1.7.3-arm64-darwin)
231-
sqlite3 (1.7.3-x86_64-darwin)
232-
sqlite3 (1.7.3-x86_64-linux)
267+
sqlite3 (2.7.4-arm64-darwin)
268+
sqlite3 (2.7.4-x86_64-darwin)
269+
sqlite3 (2.7.4-x86_64-linux-gnu)
270+
stringio (3.1.7)
233271
syntax_tree (6.1.1)
234272
prettier_print (>= 1.2.0)
235273
thor (1.2.2)
236274
timeout (0.4.3)
275+
tsort (0.2.0)
237276
tzinfo (2.0.6)
238277
concurrent-ruby (~> 1.0)
239278
unicode-display_width (2.5.0)
279+
uri (1.0.4)
280+
useragent (0.16.11)
240281
webmock (3.18.1)
241282
addressable (>= 2.8.0)
242283
crack (>= 0.3.2)
243284
hashdiff (>= 0.4.0, < 2.0.0)
285+
webrick (1.9.1)
244286
websocket-driver (0.7.5)
245287
websocket-extensions (>= 0.1.0)
246288
websocket-extensions (0.1.5)
@@ -257,20 +299,22 @@ PLATFORMS
257299

258300
DEPENDENCIES
259301
byebug
302+
csv
260303
jwt (>= 2.2.3)
261304
minitest
262305
mocha
306+
mutex_m
263307
pry
264308
pry-nav
265309
pry-stack_explorer
266-
rails (< 7)
310+
rails
267311
rails-controller-testing
268312
rake
269313
rb-readline
270314
rubocop-shopify
271315
ruby-lsp
272316
shopify_app!
273-
sqlite3 (~> 1.4)
317+
sqlite3
274318
webmock
275319

276320
BUNDLED WITH

lib/shopify_app.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ def self.use_webpacker?
6262
require "shopify_app/auth/post_authenticate_tasks"
6363
require "shopify_app/auth/token_exchange"
6464

65-
# jobs
66-
require "shopify_app/jobs/webhooks_manager_job"
67-
require "shopify_app/jobs/script_tags_manager_job"
68-
6965
# managers
7066
require "shopify_app/managers/webhooks_manager"
7167
require "shopify_app/managers/script_tags_manager"

0 commit comments

Comments
 (0)