fastlane: [Swift] undefined method `each' for nil:NilClass - Cannot Create Group Within FastlaneSwiftRunner Project
New Issue Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Issue Description
If you create a new group (also known as a “folder” reference that doesn’t create a real folder in Finder) within FastlaneSwiftRunner
project, the project compiles fine but no lanes work anymore, throwing the same error.
Command executed
bundle exec fastlane release --verbose
(custom lane)
Note: it’s not a complete output, just the useful part of it. Again, no lanes work, it doesn’t matter what it has inside of it, so the lane name doesn’t matter below.
bundle exec fastlane release --verbose
[✔] 🚀
DEBUG [2019-08-17 10:25:41.86]: Checking if there are any plugins that should be loaded...
INFO [2019-08-17 10:25:41.99]: loading manifest: /Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/swift/upgrade_manifest.json
DEBUG [2019-08-17 10:25:42.06]: No missing groups found, so we don't need to worry about adding new groups
DEBUG [2019-08-17 10:25:42.06]: Fastlane.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.55/0.9.55
DEBUG [2019-08-17 10:25:42.06]: File versions are the same, but the two files are not equal, so that's a problem, setting needs update to 'true'
DEBUG [2019-08-17 10:25:42.06]: file Fastlane.swift needs an update
DEBUG [2019-08-17 10:25:42.06]: DeliverfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.8/0.9.8
DEBUG [2019-08-17 10:25:42.06]: GymfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.4/0.9.4
DEBUG [2019-08-17 10:25:42.06]: File versions are the same, but the two files are not equal, so that's a problem, setting needs update to 'true'
DEBUG [2019-08-17 10:25:42.06]: file GymfileProtocol.swift needs an update
DEBUG [2019-08-17 10:25:42.06]: MatchfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.5/0.9.5
DEBUG [2019-08-17 10:25:42.06]: PrecheckfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.1/0.9.1
DEBUG [2019-08-17 10:25:42.06]: ScanfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.12/0.9.12
DEBUG [2019-08-17 10:25:42.06]: File versions are the same, but the two files are not equal, so that's a problem, setting needs update to 'true'
DEBUG [2019-08-17 10:25:42.06]: file ScanfileProtocol.swift needs an update
DEBUG [2019-08-17 10:25:42.06]: ScreengrabfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.1/0.9.1
DEBUG [2019-08-17 10:25:42.06]: SnapshotfileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.4/0.9.4
DEBUG [2019-08-17 10:25:42.06]: LaneFileProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: ControlCommand.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: RubyCommand.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: RubyCommandable.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: Runner.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: SocketClient.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: SocketClientDelegateProtocol.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: SocketResponse.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: ArgumentProcessor.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: main.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
DEBUG [2019-08-17 10:25:42.06]: RunnerArgument.swift FastlaneRunnerAPIVersion (bundled/target): 0.9.2/0.9.2
WARN [2019-08-17 10:25:42.06]: Lane Context:
INFO [2019-08-17 10:25:42.06]: {:LANE_NAME=>"release"}
ERROR [2019-08-17 10:25:42.06]: undefined method `each' for nil:NilClass
ERROR [2019-08-17 10:25:42.06]: fastlane finished with errors
Looking for related GitHub issues on fastlane/fastlane...
Search query: undefined method `each' for nil
URL: https://api.github.com/search/issues?q=undefined%20method%20%60each%27%20for%20nil+repo:fastlane/fastlane
➡️ [Swift] undefined method `each' for nil:NilClass - Cannot Create Group Within FastlaneSwiftRunner Project
https://github.com/fastlane/fastlane/issues/15184 [open] 3 💬
7 hours ago
➡️ Need help with Spaceship stuff that used to work
https://github.com/fastlane/fastlane/issues/15033 [open] 6 💬
9 hours ago
➡️ upload_to_testflight: fails with nil in pilot/build_manager.rb:449:in `update_build_beta_details`
https://github.com/fastlane/fastlane/issues/14977 [open] 23 💬
2 weeks ago
and 155 more at: https://github.com/fastlane/fastlane/search?q=undefined%20method%20%60each%27%20for%20nil&type=Issues&utf8=✓
🔗 You can ⌘ + double-click on links to open them directly in your browser.
bundler: failed to load command: fastlane (/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/bin/fastlane)
NoMethodError: [!] undefined method `each' for nil:NilClass
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/swift_runner_upgrader.rb:159:in `block in add_new_files_to_groups!'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/swift_runner_upgrader.rb:148:in `each'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/swift_runner_upgrader.rb:148:in `add_new_files_to_groups!'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/swift_runner_upgrader.rb:48:in `upgrade_if_needed!'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/swift_lane_manager.rb:265:in `ensure_runner_up_to_date_fastlane!'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/swift_lane_manager.rb:34:in `cruise_lane'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/commands_generator.rb:333:in `run'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/gems/fastlane-2.129.0/bin/fastlane:23:in `<top (required)>'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/bin/fastlane:23:in `load'
/Users/rogerluan/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/bin/fastlane:23:in `<top (required)>'```
</details>
### Environment
<!--
Please run `fastlane env` and copy the output below. This will help us help you.
If you used the `--capture_output` option, please remove this block as it is already included there.
-->
<details>
<details><summary>✅ fastlane environment ✅</summary>
### Stack
| Key | Value |
| --------------------------- | --------------------------------------------------------------- |
| OS | 10.14.6 |
| Ruby | 2.4.1 |
| Bundler? | true |
| Git | git version 2.20.1 (Apple Git-117) |
| Installation Source | ~/Documents/Projects/tellus-ios/.vendor/ruby/2.4.0/bin/fastlane |
| Host | Mac OS X 10.14.6 (18G87) |
| Ruby Lib Dir | /usr/local/Cellar/ruby/2.4.1_1/lib |
| OpenSSL Version | OpenSSL 1.0.2k 26 Jan 2017 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 10.3 |
### System Locale
| Variable | Value | |
| -------- | ----------- | - |
| LANG | en_US.UTF-8 | ✅ |
| LC_ALL | en_US.UTF-8 | ✅ |
| LANGUAGE | | |
### fastlane files:
<details><summary>`./fastlane/Fastfile.swift`</summary>
```ruby
// 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
//
import Foundation
class Fastfile: LaneFile {
func releaseLane() {
desc("Push a new release build to the App Store, updating the metadata.")
sh(command: "bundle exec fastlane match appstore") // Invokes the Ruby version of fastlane that uses the Ruby config file, because there's no support to Match in Swift yet.
prepareTellusCoreToBeCompiled()
buildApp(workspace: workspace, scheme: productionScheme)
deliver(username: appleID, app: appIdentifier)
slack(message: "A build has been archived, uploaded and submitted to the App Store and is now under 'Waiting for Review' status.", slackUrl: "https://hooks.slack.com/services/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", username: "Fastlane iOS Minion")
cleanUpTellusCoreChanges()
}
func onError(currentLane: String, errorInfo: String) {
switch currentLane {
case "release": cleanUpTellusCoreChanges()
default: break
}
}
// MARK: Utilities
private func prepareTellusCoreToBeCompiled() {
sh(command: "./_env.sh debug-core")
}
private func cleanUpTellusCoreChanges() {
sh(command: "./_env.sh undebug-core")
}
}
No Appfile found
fastlane gems
Gem | Version | Update-Status |
---|---|---|
fastlane | 2.129.0 | ✅ Up-To-Date |
Loaded fastlane plugins:
No plugins Loaded
Loaded gems
Gem | Version |
---|---|
did_you_mean | 1.1.0 |
bundler | 2.0.1 |
CFPropertyList | 3.0.0 |
ZenTest | 4.11.2 |
RubyInline | 3.12.4 |
concurrent-ruby | 1.1.5 |
i18n | 0.9.5 |
minitest | 5.11.3 |
thread_safe | 0.3.6 |
tzinfo | 1.2.5 |
activesupport | 4.2.11.1 |
public_suffix | 2.0.5 |
addressable | 2.6.0 |
atomos | 0.1.3 |
babosa | 1.0.2 |
claide | 1.0.3 |
fuzzy_match | 2.0.4 |
nap | 1.1.0 |
cocoapods-core | 1.7.0 |
cocoapods-deintegrate | 1.0.4 |
cocoapods-downloader | 1.2.2 |
cocoapods-plugins | 1.0.0 |
cocoapods-search | 1.0.0 |
cocoapods-stats | 1.1.0 |
netrc | 0.11.0 |
cocoapods-trunk | 1.3.1 |
cocoapods-try | 1.1.0 |
colored2 | 3.1.2 |
escape | 0.0.4 |
fourflusher | 2.3.1 |
gh_inspector | 1.1.3 |
molinillo | 0.6.6 |
ruby-macho | 1.4.0 |
nanaimo | 0.2.6 |
xcodeproj | 1.12.0 |
cocoapods | 1.7.0 |
dotenv | 2.7.5 |
osx_keychain | 1.0.2 |
cocoapods-keys | 2.1.0 |
colored | 1.2 |
highline | 1.7.10 |
commander-fastlane | 4.4.6 |
declarative | 0.0.10 |
declarative-option | 0.1.0 |
digest-crc | 0.4.1 |
unf_ext | 0.0.7.6 |
unf | 0.1.4 |
domain_name | 0.5.20190701 |
emoji_regex | 1.0.1 |
excon | 0.66.0 |
multipart-post | 2.0.0 |
faraday | 0.15.4 |
http-cookie | 1.0.3 |
faraday-cookie_jar | 0.0.6 |
faraday_middleware | 0.13.1 |
fastimage | 2.1.5 |
jwt | 2.1.0 |
memoist | 0.16.0 |
multi_json | 1.13.1 |
os | 1.0.1 |
signet | 0.11.0 |
googleauth | 0.6.7 |
httpclient | 2.8.3 |
mime-types-data | 3.2019.0331 |
mime-types | 3.2.2 |
uber | 0.1.0 |
representable | 3.0.4 |
retriable | 3.1.2 |
google-api-client | 0.23.9 |
google-cloud-env | 1.2.0 |
google-cloud-core | 1.3.0 |
google-cloud-storage | 1.16.0 |
json | 2.2.0 |
mini_magick | 4.9.5 |
multi_xml | 0.6.0 |
plist | 3.5.0 |
rubyzip | 1.2.3 |
security | 0.1.3 |
naturally | 2.2.0 |
simctl | 1.6.5 |
slack-notifier | 2.3.2 |
terminal-notifier | 2.0.0 |
unicode-display_width | 1.6.0 |
terminal-table | 1.8.0 |
tty-screen | 0.7.0 |
tty-cursor | 0.7.0 |
tty-spinner | 0.9.1 |
word_wrap | 1.0.0 |
rouge | 2.0.7 |
xcpretty | 0.3.0 |
xcpretty-travis-formatter | 1.0.0 |
ffi | 1.11.1 |
mustache | 1.1.0 |
open4 | 1.3.4 |
redcarpet | 3.4.0 |
rb-fsevent | 0.10.3 |
rb-inotify | 0.10.0 |
sass-listen | 4.0.0 |
sass | 3.7.4 |
sqlite3 | 1.4.1 |
liferaft | 0.0.6 |
xcinvoke | 0.3.0 |
jazzy | 0.10.0 |
psych | 3.0.3 |
generated on: 2019-08-15
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 65 (24 by maintainers)
Still happens in the latest version
This still happens exactly the same way still
Also still happening with ruby 2.7.0p0, fastlane 2.142.0
fastlane 2.131.0 the same problem, I can not found the way to resolute it
Bump
I recommend all the participants in the issue here that, if the backtrace and not the exception thrown is different, to open a new separate issue because it gets impossible to discard when the issue is solved for each individual case that does not match with the one that @rogerluan originally posted.
Thank you for your comprehension 😊
Pd. Feel free to mention me in the new issuesd so I can track them easily.
This will be fixed using SPM probably in #16844.
@michaelkollmann I got past this, but can’t recall the exact sequence.
I believe that, after updating fastlane and bundle in the ios directory, running
bundle exec ..
rather thanfastlane {lane}
got me beyond the error above and allowed gym to build.I then hit a second set of errors, caused by Apple changing policy for uploads. I had to:
App Uses Non-Exempt Encryption: NO
fastlane cert
to recreate credentials for upload to testflightEnv vars:
the problem still exist
Reproduced with Ruby 2.6.5 and Fastlane 2.142.0 just now
Will need a bit of time before I can tackle this issue and see the root of the problem but thanks for the heads-up @rogerluan 🤗
--verbose
usually adds more verbose output that might be helpful.I encountered a similar problem, just because I renamed the Xcode application before, and then changed Xcode 12.3 back to Xcode.
As I said, I need more context about the backtrace of the error to see if it is related to the Swift code or the back Ruby execution or an error with the socket communication.
Also, there are several traces that are unrelated you the #1584 original issue IMO.
I’m having the same problem as well:
Alright thank you very much for the example!🤗
I don’t understand your first question 😅 It’s Xcode, not SPM.
To replicate:
func testLane() { }
that does nothing, just for testing purposes. Here you can attest that it works fine.Yes, it still happens as of 2.162.0 @minuscorp 😅
Still happens in the latest version.
Any update on this? Having the same problem
This fixed my issue. I also need to do
bundle install
andbundle update fastlane
to work after step 3.Heyyy 👋 Sorry about this error! It will be fixed in new version going out later today
It seems like
file_needs_update
tries to find regex match in bundled version of Actions.swift and, due to no footer with version is exists, it fails to get matches[1] and crashes. A quick adhoc fixes problem for meMaybe it’s better to find other way of version checking? I’d suggest extended file attribute instead of text footer
Nothing different in this case (I think). I updated the original post with the verbose option 👍