fastlane: undefined method `include?' for nil:NilClass (NoMethodError)

I want to add In-APP-Purchase but I can`t find the app

my code

require 'spaceship'
require 'csv'
Spaceship::Tunes.login("xxx", "xxxx")
Spaceship::Tunes.select_team(team_id: "xxx")
app = Spaceship::Tunes::Application.find("xxxx")

output of console

/Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/client.rb:793:in `detect_most_common_errors_and_raise_exceptions': undefined method `include?' for nil:NilClass (NoMethodError)
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/client.rb:770:in `parse_response'
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/tunes/tunes_client.rb:258:in `applications'
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/tunes/application.rb:67:in `all'
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/tunes/application.rb:73:in `find'
	from iap_add.rb:7:in `<main>'
🚫 fastlane environment 🚫

Stack

Key Value
OS 12.3
Ruby 2.6.8
Bundler? true
Git git version 2.32.1 (Apple Git-133)
Installation Source /usr/local/bin/fastlane
Host macOS 12.3 (21E230)
Ruby Lib Dir /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
OpenSSL Version LibreSSL 2.8.3
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 13.4
Swift Version 5.6.1

System Locale

Error
No Locale with UTF8 found 🚫

fastlane files:

`./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
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end
end

`./Appfile`
# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple email address


# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.3.0
rake 13.0.6
rexml 3.2.5
CFPropertyList 3.0.5
public_suffix 4.0.7
addressable 2.8.0
artifactory 3.0.15
atomos 0.1.3
aws-eventstream 1.2.0
aws-partitions 1.603.0
aws-sigv4 1.5.0
jmespath 1.6.1
aws-sdk-core 3.131.2
aws-sdk-kms 1.57.0
aws-sdk-s3 1.114.0
babosa 1.0.4
bundler 2.3.4
claide 1.1.0
colored 1.2
colored2 3.1.2
highline 2.0.3
commander 4.6.0
declarative 0.0.20
digest-crc 0.6.4
unf_ext 0.0.8.2
unf 0.1.4
domain_name 0.5.20190701
dotenv 2.7.6
emoji_regex 3.2.3
excon 0.92.3
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
multipart-post 2.0.0
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.0
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.6
gh_inspector 1.1.3
jwt 2.4.1
memoist 0.16.2
multi_json 1.15.0
os 1.1.4
signet 0.17.0
googleauth 1.2.0
httpclient 2.8.3
mini_mime 1.1.2
trailblazer-option 0.1.2
uber 0.1.0
representable 3.2.0
retriable 3.1.2
webrick 1.7.0
google-apis-core 0.7.0
google-apis-androidpublisher_v3 0.24.0
google-apis-playcustomapp_v1 0.10.0
google-apis-iamcredentials_v1 0.13.0
google-apis-storage_v1 0.17.0
google-cloud-env 1.6.0
google-cloud-errors 1.2.0
google-cloud-core 1.6.0
google-cloud-storage 1.37.0
json 2.6.2
mini_magick 4.11.0
naturally 2.2.1
optparse 0.1.1
plist 3.6.0
rubyzip 2.3.2
security 0.1.3
simctl 1.6.8
terminal-notifier 2.0.0
unicode-display_width 1.8.0
terminal-table 1.8.0
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
nanaimo 0.3.0
xcodeproj 1.22.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1

generated on: 2022-07-07

About this issue

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

Commits related to this issue

Most upvoted comments

Will get that done today and new version released tonight some time!

any update?

Any update?

Hey sorry! I commented way to late in my evening and didn’t fully understand the problem 🤦‍♂️

I’ll make that PR to fix the unit and then also look if we use this anywhere else and fix it there as well.

Will get that done today and new version released tonight some time!

Hey, everyone 👋 Sorry for getting here so late!

Usage of Spaceship::Tunes

What @lucgrabowski mentions about Spaceship::Tunes is what I would have said too! It’s using the legacy private API that can change or shut down without us knowing. Using Spaceship::ConnectAPI is the most recommend way as that uses either the new private Apple ID auth endpoints or the official App Store Connect API with API Key auth.

However, there are times where you still need to use Spaceship::Tunes with with IAP 😬

Good news

App Store Connect API 2.0 just dropped yesterday with official support for IAP. This is huge but it’s not a easy implementation or migration. There are over 104 new endpoints that we will need to design into fastlane better.

So there will be super stable official support for IAP soon ™️ I don’t have an estimate date yet as I’m still going through everything from yesterday evening’s release.

Apparently this is causing MS App Center to fail too. MS just replied to me indicating that its this issue.

✨ Official Update

I got a pull request finally up for some fixes here - https://github.com/fastlane/fastlane/pull/20480

Fixed fastlane init

fastlane init will no longer use Spaceship::Tunes::Application.find (which was broken due to an endpoint being no longer available) and is now using Spaceship::ConnectAPI::App.find

That was the easy one 😊

Temporary patch on Spaceship::Tunes::Application.find

I know that Spaceship::Tunes::Application.find still needs to be used for IAPs so I retrofitted this method to be powered by Spaceship::ConnectAPI::App.find. It’s a terrible retrofit since there is no way to nicely get all of the data that but you’ll at least get app id, app name, and available platforms.

This should also hopefully fix the issues that App Center is having with the App Store Distributions. I don’t know for sure since I think they use Spaceship::Tunes::Application on their backend but I’m hoping this retrofit works for them if they are using it 🤷‍♂️ I’m still trying to get in contact with them.

Adding IAP support to Spaceship::ConnectAPI

This is not part of this PR but I a working on it. I have an issue I’ll post feedback on soon here - https://github.com/fastlane/fastlane/issues/20477

It will take some time because there are A LOT of new PRs but follow that issue for more info


That is all! So sorry about this taking so long. It ended up being a pretty back task to retrofit but I’m hoping it works out for some of you.

If any of you are able to test this PR / branch to make sure the retrofit is working for you that would be 🔥 I need to go to bed now so I’ll look at any response in the morning 😊

For people having issues with app center, you can download the ipa file from app center distribute option. And run below command to upload your builds manually.

xcrun altool --upload-app -f Flyhomes.ipa -type ios -u USERNAME -p PASSWORD

PS: Make sure latest xcode command line tools are installed.

I believe the error is on the Apple side. Spaceship calls this endpoint to get the application data: https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary/v2

and it is returning something like this:

{"data":null,"messages":{"warn":null,"error":null,"info":null},"statusCode":"SUCCESS"}

Spaceship thinks it’s an error message because it has a null value in the data field and tries to get the error message in an empty string.

I think apple used to return a response like this: https://github.com/fastlane/fastlane/blob/2.19.2/spaceship/spec/tunes/fixtures/app_summary.json

but I’m not sure about it.

Also hitting this issue with fastlane init.

/Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/client.rb:793:in `detect_most_common_errors_and_raise_exceptions': [!] undefined method `include?' for nil:NilClass (NoMethodError)
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/client.rb:770:in `parse_response'
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/tunes/tunes_client.rb:258:in `applications'
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/tunes/application.rb:67:in `all'
	from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.207.0/spaceship/lib/spaceship/tunes/application.rb:73:in `find'

@wallisch : Thanks a lot for the clarification. Since you’re a contributor, do you have any Idea in what timeframe we can expect Fastlane adapting to Apples API changes (jusst guessing that this is not the first time happening)? I don’t want to stress anyone, but I have absolutley zero experience with directly manually releasing to iOS App Store and now need to assess whether to wait for a fix or if I should better learn how to build and release on my own to iOS App Store.

You can upload your version manually. It’s easy than upload by fastlane. You need set correct version and build number, archive app and upload to app store

thanks for the workaround but, with all due respect, a lot of people who are using App Center are doing this because they don’t necessarily have the time to upload versions manually and they are under pressure (e.g. me). This is why we need at least a time frame. thanks.

✨ Official Thought

I might be able to patch/hack this in an fastlane update that MS AppCenter can use but I won’t love it 😬

Going to experiment by guessing the APIs they are using but I’d still like to talk to their team about an official and long term fix

Will update when I have more info!

Hey sorry! I totally somehow missed that this is somehow effecting AppCenter 🤔

I’m not an AppCenter user so I have to get one of my apps setup to figure out exactly what is wrong but I’m not sure how this effecting AppCenter.

Going full focus this now and will hopefully have some resolution by end of day!

I would recommend using Spaceship::ConnectAPI which is used by AppstoreConnect, it’s a newer API thanSpaceship::Tunes. (Spaceship::Tunes is a legacy API). There is an example how to fetch applications in https://github.com/fastlane/fastlane/blob/master/spaceship/docs/AppStoreConnect.md#applications - please note that unfortunately there are still examples using legacy Spaceship::Tunes in this docs. I also don’t think that there is a migration guide and some investigation of models could be helpful when migrating: https://github.com/fastlane/fastlane/tree/master/spaceship/lib/spaceship/connect_api/models

Edit: as @caiotava said above, server doesn’t return data and spaceship tries to parse error from message["errors"] which is null and it fails with undefined method include? for nil:NilClass. After fixing this undefined method we still would get an Unexpected Response error with a liitle bit more details, but the main problem here is that server returns no data.

I found a temporary workaround for accessing some resources of iTunes Connect API.

To avoid calling the endpoint: https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary/v2 I create a new Application manually with data from ConnectAPI.

It should not be suitable for all cases, but it has worked for me until now.

Old call to get application data

app = Spaceship::Tunes::Application.find(app_id)

An alternative way to get data from ConnectAPI and create an application manually

conn_app = Spaceship::ConnectAPI.get_app(app_id: app_id).first

app = Spaceship::Tunes::Application.factory({})
app.apple_id = conn_app.id
app.name = conn_app.name
app.bundle_id = conn_app.bundle_id

The pull request #20480 that closed this issue was merged and released as part of fastlane 2.208.0 🚀 Please let us know if the functionality works as expected as a reply here. If it does not, please open a new issue. Thanks!

Same issue on appcenter. We need a temporarily work around.

Has anyone submitted an Apple Developer bug report or via Apple Developer support?

Just curious, using official tool Transporter doesn’t have an issue, is fastlane using some private api?

Hello everyone Currently I fixed the problem with fastlane init locally: Specifically in setup_ios.rb, find this method verify_app_exists_itc Find this code: app = Spaceship::Tunes::Application.find(self.app_identifier) Replace with: app = Spaceship::ConnectAPI::App.find(self.app_identifier) then save the code This will work fine

@sk-chanch Glad to hear!!

@SoftWyer No problem! I actually talked to some of the team this morning and I’m going to keep a formal relationship with them open so that I can communicate any changes that might affect them. I think this will be good for both fastlane and App Center 💪

Thanks @joshdholtz for fixing the issue for App Center since they didn’t seem to have any impetus to fix it. I swear that product’s dead even though they allude to working on a major update.

Here’s the update I got from App Center support:

Hi there,

Thank you for contacting us.

The App Center engineering team is working with high priority to deploy a fix. We apologize for the inconvenience.

This incident is caused by an issue with FastLane:

https://github.com/fastlane/fastlane/issues/20444

We have also updated our status page so you can subscribe to it for automatic updates as we progress towards a resolution:

https://status.appcenter.ms/incidents/ts3n2ks33wt9

Best regards,

Ximei.

@joshdholtz I understand it seems the most impactful TODO item here being AppCenter and all its users, but the originally reported issue is about IAP uploading flow. Do you mean that after getting past the app selection step, the existing APIs should be good to go about uploading in app purchases? Or are we out of luck on that? I’ll also upgrade that part of the flow now & report back my findinds.

@rafaelnobrekz I totally read “IAP” and “IPA” 🙄 My apologies on that… that was a really unfortunate misread on my part 🤦‍♂️

The in-app purchase APIs I’m working on… It’s a very slow process because its a huge change and there are a lot of new APIs 😬 I’ll create a new issue (and pin it) to discuss that one (outside of this one because its slightly different).

You can follow https://github.com/fastlane/fastlane/issues/20477 for the IAP stuff

Experiencing the same internal server issue 500 that other users have reported.

##[error]{“code”:“internal_server_error”,“message”:“internal error (Support ID: 0b13f7e4-0908-4583-92f4-6efba58a508c)”}

This happens when sending a successful / completed build from AppCenter -> Appstoreconnect

Since a 500 is general server and disclaimer without any further logs - I reached out to Apple.

Thanks @joshdholtz I’ve also contacted them again from my side, asking them to get in touch with you.

@will-gluwa Thank you!! Hopefully I can get an official relationship with them after this to prevent downtime in the future

Sorry again about this, fam!

Thanks @joshdholtz I’ve also contacted them again from my side, asking them to get in touch with you.

@joshdholtz Here is my log before it fails:

==============================================================================
Task         : App Center distribute
Description  : Distribute app builds to testers and ***s via Visual Studio App Center
Version      : 3.200.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/app-center-distribute
==============================================================================
(node:24577) Warning: Use Cipheriv for counter mode of aes-256-ctr
... (removed about about 20 instances of the Cipheriv warning)
(node:24577) Warning: Use Cipheriv for counter mode of aes-256-ctr
##[error]{"code":"internal_server_error","message":"internal error (Support ID: 601e8752-8d7e-4558-b4fd-25ed9dc49a6e)"}
http response code: 500

With Spaceship::Tunes.login I was able to access apps of other teams where I have been invited to. Since this does not work anymore, I tried it with Spaceship::ConnectAPI but this seams to require an API Access for each team, which does not work for me.

One task is e.g.: (similar to @aizliang )

clientTunes = Spaceship::Tunes.login('xxx', 'xxx')
clientTunes.team_id = xxx
clientTunes.applications.to_json

Will be there a workaround for this?

Same issue on appcenter.

This is still working through AppStoreRelease@1 task on pipelines and ServiceConnection in ADO

This is probably neither fastlanes nor MS App Centers fault, it seems like Apple changed their API, thus spaceship client is confused.

App Center Support mentionned the same to me, currently not able to distribute to iOS Store apparently due to this Fastlane issue, it’s a real unfortunate situation, since our release pipelines fully depend on App Center (and thus as it seems on Fastlane). Any hints from someone at Fastlane working on it or not? If its not possible to work on it soon, please share a bit some insight, since I need to manage Expectations to my whole Team. (by the way not blaming Fastlane here, if I were at MS App Center, I’d simply make a rollback of whatever Fastlane dependency update they did yesterday, but they do not seem to really care)