fastlane/fastlane

[Regression] uninitialized constant Fastlane::OpenStruct (NameError) with release 2.220.0

bbjay opened this issue · 11 comments

New Regression Checklist

Regression Information

  • Breaking version: 2.220.0
  • Last working version: 2.219.0

Regression Description

One of my CI workflows for pulling in metadata from Google Play stopped working today.
The affected lane is fetch_metadata_cd which is using download_from_play_store

Complete output when running fastlane, including the stack trace and command used
✅ fastlane environment ✅

Stack

Key Value
OS debian_based bullseye/sid
Ruby 2.7.2
Bundler? false
Git git version 2.25.1
Installation Source ~/.rbenv/versions/2.7.2/bin/fastlane
Host Ubuntu 20.04.6 LTS debian_based bullseye/sid (5.15.0-1040-gcp)
Ruby Lib Dir ~/.rbenv/versions/2.7.2/lib
OpenSSL Version OpenSSL 1.1.1f 31 Mar 2020
Is contained false
Is homebrew false
Is installed via Fabric.app false

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE en_US.UTF-8

fastlane files:

`./fastlane/Fastfile`
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

default_platform(:android)

platform :android do
  desc "Deploy a new version to Google Play internal testing"
  lane :beta do
    v = flutter_version()
    upload_to_play_store(
      track: 'internal',
      aab: '../build/app/outputs/bundle/release/app-release.aab',
      json_key: 'google-play-api-key.json',
      version_name: "#{v['version_name']}(#{v['version_code']})",
    )
  end


  desc "Deploy a new version to Google Play internal testing (for continuous deployment)"
  lane :betaCD do
    v = flutter_version()
    upload_to_play_store(
      track: 'internal',
      aab: '../build/app/outputs/bundle/release/app-release.aab',
      json_key_data: ENV['GCLOUD_SERVICE_ACCOUNT_CREDENTIALS'],
      version_name: "#{v['version_name']}(#{v['version_code']})",
    )
  end

  desc "Fetch latest metadata from Google Play Store production"
  lane :fetch_metadata do
    download_from_play_store(
      track: 'production',
      json_key: 'google-play-api-key.json',
    )
  end

  desc "Fetch latest metadata from Google Play Store production (for continuous deployment)"
  lane :fetch_metadata_cd do
    download_from_play_store(
      track: 'production',
      json_key_data: ENV['GCLOUD_SERVICE_ACCOUNT_CREDENTIALS'],
    )
  end
end
`./fastlane/Appfile`
package_name("com.myappid")

fastlane gems

Gem Version Update-Status
fastlane 2.220.0 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-flutter_version 1.1.15 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.4.0
babosa 1.0.4
bundler 2.1.4
colored 1.2
highline 2.0.3
commander 4.6.0
dotenv 2.8.1
emoji_regex 3.2.3
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
faraday-multipart 1.0.4
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
faraday-retry 1.0.3
ruby2_keywords 0.0.5
faraday 1.10.3
faraday_middleware 1.2.0
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
gh_inspector 1.1.3
google-apis-playcustomapp_v1 0.13.0
google-cloud-env 1.6.0
mini_magick 4.12.0
naturally 2.2.1
rubyzip 2.3.2
security 0.1.5
simctl 1.6.10
terminal-notifier 2.0.0
terminal-table 3.0.2
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
uri 0.10.0
public_suffix 5.0.5
addressable 2.8.6
artifactory 3.0.17
aws-eventstream 1.3.0
aws-sigv4 1.8.0
aws-partitions 1.907.0
jmespath 1.6.2
aws-sdk-core 3.191.6
aws-sdk-kms 1.78.0
aws-sdk-s3 1.146.1
base64 0.2.0
nkf 0.2.0
rexml 3.2.6
CFPropertyList 3.0.7
excon 0.110.0
multipart-post 2.4.0
domain_name 0.6.20240107
fastimage 2.3.1
httpclient 2.8.3
multi_json 1.15.0
jwt 2.8.1
signet 0.19.0
os 1.1.4
googleauth 1.8.1
mini_mime 1.1.5
retriable 3.1.2
trailblazer-option 0.1.2
declarative 0.0.20
uber 0.1.0
representable 3.2.0
google-apis-core 0.11.3
google-apis-androidpublisher_v3 0.54.0
rake 13.2.0
digest-crc 0.6.5
google-apis-storage_v1 0.31.0
google-apis-iamcredentials_v1 0.17.0
google-cloud-errors 1.4.0
google-cloud-core 1.7.0
google-cloud-storage 1.47.0
json 2.7.2
optparse 0.4.0
plist 3.7.1
unicode-display_width 2.5.0
tty-screen 0.8.2
nanaimo 0.3.0
colored2 3.1.2
claide 1.1.0
atomos 0.1.3
xcodeproj 1.24.0
forwardable 1.3.1
logger 1.4.2
cgi 0.1.0
date 3.0.0
timeout 0.1.0
stringio 0.1.0
ipaddr 1.2.2
openssl 2.1.2
zlib 1.1.0
mutex_m 0.1.0
strscan 1.0.3
io-console 0.5.6
delegate 0.1.0
fileutils 1.4.1
etc 1.1.0
singleton 0.1.0
open3 0.1.0
yaml 0.1.0
psych 3.1.0
fastlane-plugin-flutter_version 1.1.15

generated on: 2024-04-04

$ fastlane fetch_metadata_cd
[12:13:57]: fastlane detected a Gemfile in the current directory
[12:13:57]: However, it seems like you didn't use `bundle exec`
[12:13:57]: To launch fastlane faster, please use
[12:13:57]: 
[12:13:57]: $ bundle exec fastlane fetch_metadata_cd
[12:13:57]: 
[12:13:57]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
/home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/erb_template_helper.rb:20:in `': uninitialized constant Fastlane::OpenStruct (NameError)
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/erb_template_helper.rb:1:in `'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/mailgun.rb:1:in `'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:113:in `block in load_default_actions'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:112:in `each'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:112:in `load_default_actions'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane.rb:38:in `load_actions'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:34:in `start'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/bin/fastlane:23:in `'
	from /home/builder/.rbenv/versions/2.7.2/bin/fastlane:23:in `load'
	from /home/builder/.rbenv/versions/2.7.2/bin/fastlane:23:in `'

Environment

$ fastlane env
[12:13:54]: fastlane detected a Gemfile in the current directory
[12:13:54]: However, it seems like you didn't use `bundle exec`
[12:13:54]: To launch fastlane faster, please use
[12:13:54]: 
[12:13:54]: $ bundle exec fastlane env
[12:13:54]: 
[12:13:54]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
/home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/erb_template_helper.rb:20:in `': uninitialized constant Fastlane::OpenStruct (NameError)
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/erb_template_helper.rb:1:in `'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/mailgun.rb:1:in `'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:113:in `block in load_default_actions'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:112:in `each'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:112:in `load_default_actions'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane.rb:38:in `load_actions'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:34:in `start'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
	from /home/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fastlane-2.220.0/bin/fastlane:23:in `'
	from /home/builder/.rbenv/versions/2.7.2/bin/fastlane:23:in `load'
	from /home/builder/.rbenv/versions/2.7.2/bin/fastlane:23:in `'

We're facing the same issue on another project

we tried to force the version of fastlane to an old one using

gem 'fastlane', '2.219.0'

and also to include ostruct in the gemfile but without any success

gem 'ostruct'

the environment :

  • OS seems to be ubuntu-20.04
  • bundler:1.17.2
  • ruby: 2.7.0

seems to work after upgrading versions in the github file :

  • ruby-version: 3.3

and installed manually the bundler with an higher version

gem install bundler -v 2.4.22
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: false

      - name: Setup fastlane
        id: set_up_fastlane
        run: |
          gem install bundler -v 2.4.22
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3

I'm using 2.206.2 and it crashed with the same error.
So doesn't seem to be related to 2.220.0

Still a valid issue of course.

In our use case, freezing Gemfile version to 2.219.0 did the trick for a clean bundle update, so I'd suspect the latest update to actually cause the issue. 🤔 Seen on some Linux deployment with Ruby 2.6.6, I'd guess the situation would be the same on macOS with system Ruby 2.6.

seems to work after upgrading versions in the github file :

  • ruby-version: 3.3

and installed manually the bundler with an higher version

gem install bundler -v 2.4.22
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: false

      - name: Setup fastlane
        id: set_up_fastlane
        run: |
          gem install bundler -v 2.4.22
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3

Thank you so much, worked like a charm.

We also had this issue since yesterday when running tests or builds for android.
Using the combination of fastlane 2.220.0 with bundler 2.4.22 and ruby 2.7 we had this problem. Just downgrading to fastlane 2.219.0 didn't worked.
With the combination of fastlane 2.220.0 or 2.219.0 with bundler 2.4.22 and ruby 3.3 it works again.
Thanks @florent37 for the hint!

I'm using currently using RUBYOPT='-rostruct' env variable as a workaround in GitHub Actions:

- run: bundle exec fastlane ...
  env:
    RUBYOPT: '-rostruct' # TODO: Remove when https://github.com/fastlane/fastlane/pull/21950 gets released

Related? #21942

The -rostruct workaround didn't help.

I use a workaround with the below code.
It's cicd on gitlab.

variables:
    # TODO: Remove when https://github.com/fastlane/fastlane/pull/21950 gets released
    RUBYOPT: "-rostruct"

I have fastlane on a local machine, not gitlab, but the same override works. My versions:

  • ruby -v ruby 2.7.0p0
  • fastlane 2.220.0 (? from Gemfile.lock)
  • bundle -v version 2.3.14

and also got the above NameError. Adding RUBYOPT override inline with my bundle exec works:

…
# TODO: Try removing RUBYOPT override after https://github.com/fastlane/fastlane/pull/21950 gets released
RUBYOPT="-rostruct" bundle exec fastlane beta

As mentioned above, it affects older 2.219.0 as well, we've just found this happening on a Docker image with Linux + Ruby 2.6/2.7. RUBYOPT="-rostruct" hotfix worked. Hopefully the MR mentioned will get merged soon, followed by a hotfix release. 🙏