Add ostruct gem to fix production boot on Ruby 3.4#372
Merged
Conversation
Production (points-production) is crashing on boot with: madmin-1.2.8/lib/madmin/resource.rb:39:in 'attribute': uninitialized constant OpenStruct (NameError) Ruby 3.4 removed ostruct from the default gems (it is now a bundled gem that must be declared in the Gemfile). madmin 1.2.8 uses OpenStruct without requiring "ostruct", so on Ruby 3.4 the constant is undefined, Puma fails to boot, and every request returns 503 (H10 App crashed). madmin's rescue in resource.rb re-raises the NameError as a misleading "couldn't find attribute 'id'" ArgumentError, which masks the real cause. Declaring gem "ostruct" makes Bundler.require load it at boot so OpenStruct is defined. Applied to Gemfile.lock and Gemfile.next.lock. This is a hotfix to restore production; the madmin 2.x upgrade (#371) is the longer-term fix and removes the incompatibility entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hotfix: restore production boot on Ruby 3.4
Production (
points-production) is down. Puma crashes on boot and every request returns 503 (H10 App crashed).Root cause
Ruby 3.4 removed
ostructfrom the default gems, it is now a bundled gem that must be declared in theGemfile. madmin 1.2.8 usesOpenStructwithoutrequire "ostruct", so on Ruby 3.4 the constant is undefined, boot fails, and the app crashes.madmin's
rescueinresource.rbre-raises theNameErroras a misleadingArgumentError: couldn't find attribute 'id' on Estimate model, which masks the real cause in the logs.Fix
Declare
gem "ostruct"soBundler.requireloads it at boot andOpenStructis defined. Applied to bothGemfile.lockandGemfile.next.lock.Scope
Minimal, reversible hotfix to get production back up. The madmin 2.x upgrade (#371) is the longer-term fix and removes this incompatibility entirely.