fastlane: select_team': undefined method `[]' for nil:NilClass (NoMethodError)

New Regression Checklist

Regression Information

  • Breaking version: [2.205.0]
  • Last working version: [2.204.3]

Regression Description

It crashes once I run select_team

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

Spaceship::Tunes.select_team

Multiple App Store Connect teams found, please enter the number of the team you want to use: Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile: Alternatively you can pass the team name or team ID using the FASTLANE_ITC_TEAM_ID or FASTLANE_ITC_TEAM_NAME environment variable

/Users/xxx/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/fastlane-2.205.0/spaceship/lib/spaceship/tunes/tunes_client.rb:98:in block in select_team': undefined method []’ for nil:NilClass (NoMethodError) from /Users/xxx/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/fastlane-2.205.0/spaceship/lib/spaceship/tunes/tunes_client.rb:91:in loop' from /Users/xxx/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/fastlane-2.205.0/spaceship/lib/spaceship/tunes/tunes_client.rb:91:in select_team’ from /Users/xxx/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/fastlane-2.205.0/spaceship/lib/spaceship/tunes/spaceship.rb:35:in select_team' from (irb):12:in <main>’ from /Users/xxx/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/irb-1.3.5/exe/irb:11:in <top (required)>' from /Users/xxx/.rbenv/versions/3.0.2/bin/irb:23:in load’ from /Users/xxx/.rbenv/versions/3.0.2/bin/irb:23:in `<main>’

Environment

🚫 fastlane environment 🚫

Stack

Key Value
OS 12.0.1
Ruby 3.0.2
Bundler? false
Git git version 2.30.1 (Apple Git-130)
Installation Source ~/.rbenv/versions/3.0.2/bin/fastlane
Host macOS 12.0.1 (21A559)
Ruby Lib Dir ~/.rbenv/versions/3.0.2/lib
OpenSSL Version OpenSSL 1.1.1l 24 Aug 2021
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 13.1
Swift Version 5.5.1

System Locale

Error
No Locale with UTF8 found 🚫

fastlane files:

No Fastfile found

No Appfile found

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.5.0
atomos 0.1.3
rexml 3.2.5
CFPropertyList 3.0.4
claide 1.0.3
colored2 3.1.2
nanaimo 0.3.0
xcodeproj 1.21.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
unicode-display_width 1.8.0
terminal-table 1.8.0
plist 3.6.0
public_suffix 4.0.6
addressable 2.8.0
multipart-post 2.0.0
word_wrap 1.0.0
optparse 0.1.1
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
artifactory 3.0.15
babosa 1.0.4
colored 1.2
highline 2.0.3
commander 4.6.0
excon 0.88.0
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
ruby2_keywords 0.0.5
faraday 1.8.0
unf_ext 0.0.8
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.4
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.5
gh_inspector 1.1.3
json 2.5.1
mini_magick 4.11.0
naturally 2.2.1
rubyzip 2.3.2
security 0.1.3
xcpretty-travis-formatter 1.0.1
dotenv 2.7.6
bundler 2.2.22
simctl 1.6.8
jwt 2.3.0
uber 0.1.0
declarative 0.0.20
trailblazer-option 0.1.1
representable 3.1.1
retriable 3.1.2
mini_mime 1.1.2
memoist 0.16.2
multi_json 1.15.0
os 1.1.1
signet 0.16.0
googleauth 1.1.0
httpclient 2.8.3
webrick 1.7.0
google-apis-core 0.4.1
google-apis-playcustomapp_v1 0.6.0
google-apis-androidpublisher_v3 0.13.0
google-cloud-env 1.5.0
google-cloud-errors 1.2.0
google-cloud-core 1.6.0
google-apis-iamcredentials_v1 0.8.0
google-apis-storage_v1 0.9.0
rake 13.0.3
digest-crc 0.6.4
google-cloud-storage 1.34.1
emoji_regex 3.2.3
jmespath 1.4.0
aws-partitions 1.521.0
aws-eventstream 1.2.0
aws-sigv4 1.4.0
aws-sdk-core 3.121.5
aws-sdk-kms 1.50.0
aws-sdk-s3 1.104.0
tsort 0.1.0
uri 0.10.1
set 1.0.1
forwardable 1.3.2
logger 1.4.3
pathname 0.1.0
shellwords 0.1.0
cgi 0.2.0
date 3.1.0
timeout 0.1.1
stringio 3.0.0
openssl 2.2.0
io-nonblock 0.1.0
ipaddr 1.2.2
io-wait 0.1.0
zlib 1.1.0
resolv 0.2.0
securerandom 0.1.0
digest 3.0.0
time 0.1.0
open-uri 0.1.0
mutex_m 0.1.1
net-protocol 0.1.0
ostruct 0.3.1
english 0.7.1
erb 2.2.0
strscan 3.0.0
abbrev 0.1.0
io-console 0.5.7
tempfile 0.1.1
delegate 0.2.0
fileutils 1.5.0
tmpdir 0.1.2
base64 0.1.0
singleton 0.1.1
net-http 0.1.1
open3 0.1.1
nkf 0.1.0
prettyprint 0.1.0
pp 0.1.0
find 0.1.0
yaml 0.1.1
psych 3.3.0

generated on: 2022-03-18

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 25 (7 by maintainers)

Most upvoted comments

Same here.

Ruby version: 3.1.1 React Native: 0.67.3 fastlane: 2.205.0

Steps to reproduce:

inside ios folder

  1. Rewrite gemfile
source "https://rubygems.org"

# gem "fastlane"
gem "fastlane", :git => "https://github.com/nomunomu0504/fastlane.git", :branch => "fix-teams-undefined-key"
  1. bundle update
  2. fastlane init
[19:47:24]: --------------------
[19:47:24]: fastlane init failed
[19:47:24]: --------------------
[19:47:24]: undefined method `[]' for nil:NilClass

          puts("#{i + 1}) \"#{team['contentProvider']['name']}\" (#{team['contentProvider']['contentProviderId']})")
                                                     ^^^^^^^^
[19:47:24]: Something failed while running `fastlane init`
[19:47:24]: Tried using Apple ID with email '***'
[19:47:24]: You can either retry, or fallback to manual setup which will create a basic Fastfile
[19:47:24]: Would you like to fallback to a manual Fastfile? (y/n)

The following PR corrects this problem. https://github.com/fastlane/fastlane/pull/20088

Temporarily, you can work around this problem by rewriting the fastlane in the Gemfile as follows

gem "fastlane", :git => "https://github.com/nomunomu0504/fastlane.git", :branch => "fix-teams-undefined-key"

If you have rewritten the gemfile, be sure to run bundle update.

@nomunomu0504 Actually I think it was my mistake and i didn’t know how to use the bundler properly. Instead of fastlane init, bundle exec fastlane init works fine. Thanks. 🙇‍♂

@seokjeatuiti @felipepalazzo I pushed repair commit of some error, and did not cause any errors in my environment. please retry 🙇‍♂

Ruby version: 3.1.1 React Native: 0.67.4 fastlane: 2.205.0 of this

  1. fastlane init
❯ asdf exec bundle exec fastlane init
[✔] 🚀 
[✔] Looking for iOS and Android projects in current directory...
[00:39:15]: Created new folder './fastlane'.
[00:39:15]: Detected an iOS/macOS project in the current directory: 'react_native.xcworkspace'
[00:39:15]: -----------------------------
[00:39:15]: --- Welcome to fastlane 🚀 ---
[00:39:15]: -----------------------------
[00:39:15]: fastlane can help you with all kinds of automation for your mobile app
[00:39:15]: We recommend automating one task first, and then gradually automating more over time
[00:39:15]: What would you like to use fastlane for?
1. 📸  Automate screenshots
3. 👩‍✈️  Automate beta distribution to TestFlight
4. 🚀  Automate App Store distribution
5. 🛠  Manual setup - manually setup your project to automate your tasks
?. 2
[00:39:26]: -----------------------------------------------------------
[00:39:26]: --- Setting up fastlane for iOS TestFlight distribution ---
[00:39:26]: -----------------------------------------------------------
[00:39:26]: Parsing your local Xcode project to find the available schemes and the app identifier
[00:39:26]: Resolving Swift Package Manager dependencies...
[00:39:26]: $ xcodebuild -resolvePackageDependencies -workspace react_native.xcworkspace -scheme react_native
...
[00:39:36]: $ cd /Users/nomunomu/projects/fastlane_test/react_native/ios && agvtool what-version -terse
[00:39:37]: ▸ 1
[00:39:37]: --------------------------------
[00:39:37]: --- Login with your Apple ID ---
[00:39:37]: --------------------------------
[00:39:37]: Please enter your Apple ID developer credentials
[00:39:37]: Apple ID Username:
<< Input your apple id username >>

[00:39:49]: Logging in...
Available session is not valid any more. Continuing with normal login.
Multiple App Store Connect teams found, please enter the number of the team you want to use: 
1) "Org1" (xxxxxxxxxx)
2) "Parson1" (yyyyyyy)
3) "Org2" (zzzzzzzz)

I tried the workaround above, still getting the error:

Multiple App Store Connect teams found, please enter the number of the team you want to use:
[09:39:17]: --------------------
[09:39:17]: fastlane init failed
[09:39:17]: --------------------
[09:39:18]: undefined method `[]' for nil:NilClass

Fixed for us on 2.205.1. We made sure our WWDR certificates are updated as part of our scripts, as noted in this SO post: https://stackoverflow.com/questions/71850186/invalid-provisioning-profile-signature-state-error-validation-error-90165

If you are still encountering this error, please first update your WWDR certificates. If after updating those you still encounter it, create a ticket instead of posting here. Thank you!

Thank you!! This works. I already had changed my Gemfile, but the key was including require "bundler/setup"

@tymcdowell Thanks report. I tried this code and did not cause any errors in my environment.

  • Gemfile
source "https://rubygems.org"

gem "fastlane", :git => "https://github.com/nomunomu0504/fastlane.git", :branch => "fix-teams-undefined-key"
  • test.rb
require "bundler/setup"
require "spaceship"

Spaceship::Tunes.login("#{devAcctEmail}")
Spaceship::Tunes.select_team

How to run(I using asdf for manage multiple version) Ruby 2.6.0

$ asdf exec bundle install
Fetching https://github.com/nomunomu0504/fastlane.git
Updating files: 100% (2733/2733), done.
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
...
Using fastlane 2.205.0 from https://github.com/nomunomu0504/fastlane.git (at fix-teams-undefined-key@4d83d3d)
Bundle complete! 1 Gemfile dependency, 90 gems now installed.
Bundled gems are installed into `./vendor/bundle`

$ asdf exec bundler exec ruby test.rb 
Available session is not valid any more. Continuing with normal login.
Multiple App Store Connect teams found, please enter the number of the team you want to use: 
Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile:
Alternatively you can pass the team name or team ID using the `FASTLANE_ITC_TEAM_ID` or `FASTLANE_ITC_TEAM_NAME` environment variable

  itc_team_id "xxxxxxxxxx"

or

  itc_team_name "Org1"

1) "Org1" (xxxxxxxxxx)
2) "Parson1" (yyyyyyy)
3) "Org2" (zzzzzzzz)

@tymcdowell Thanks report. I tried this code and did not cause any errors in my environment.

  • Gemfile
source "https://rubygems.org"

gem "fastlane", :git => "https://github.com/nomunomu0504/fastlane.git", :branch => "fix-teams-undefined-key"
  • test.rb
require "bundler/setup"
require "spaceship"

Spaceship::Tunes.login("#{devAcctEmail}")
Spaceship::Tunes.select_team

How to run(I using asdf for manage multiple version) Ruby 2.6.0

$ asdf exec bundle install
Fetching https://github.com/nomunomu0504/fastlane.git
Updating files: 100% (2733/2733), done.
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
...
Using fastlane 2.205.0 from https://github.com/nomunomu0504/fastlane.git (at fix-teams-undefined-key@4d83d3d)
Bundle complete! 1 Gemfile dependency, 90 gems now installed.
Bundled gems are installed into `./vendor/bundle`

$ asdf exec bundler exec ruby test.rb 
Available session is not valid any more. Continuing with normal login.
Multiple App Store Connect teams found, please enter the number of the team you want to use: 
Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile:
Alternatively you can pass the team name or team ID using the `FASTLANE_ITC_TEAM_ID` or `FASTLANE_ITC_TEAM_NAME` environment variable

  itc_team_id "xxxxxxxxxx"

or

  itc_team_name "Org1"

1) "Org1" (xxxxxxxxxx)
2) "Parson1" (yyyyyyy)
3) "Org2" (zzzzzzzz)

@nomunomu0504 bundle exec fastlane init worked for me as well

same as @seokjeatuiti, even after running bundle update, I still get the error.

@seokjeatuiti cc: @felipepalazzo

I understood. I fixed later 😦

@felipepalazzo

Thanks for the details. I tried the reproduction method and it did not cause any errors in my environment.

If you have rewritten the gemfile, be sure to run bundle update.

If you do not run bundle update, the modified library will not be imported and the faulty library will be used.

I have updated the comment I just posted… https://github.com/fastlane/fastlane/issues/20086#issuecomment-1072184897

@nomunomu0504 To give you some context, I’m using React Native v0.66.4.

Steps to reproduce:

  • inside ios folder, run fastlane init
  • select option 2, “Automate beta distribution to TestFlight”
  • type your Apple ID Username (in my case, I have Admin rights)
  • just after that step, I see the error in the terminal

The following PR corrects this problem. #20088

Temporarily, you can work around this problem by rewriting the fastlane in the Gemfile as follows

gem "fastlane", :git => "https://github.com/nomunomu0504/fastlane.git", :branch => "fix-teams-undefined-key"

This worked for me using spaceship. Thank you