fastlane: update_project_provisioning failed

New Issue Checklist

Issue Description

fastlane finished with errors:

/Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/update_project_provisioning.rb:73:in `block (2 levels) in run': [!] undefined method `[]' for nil:NilClass (NoMethodError)
Command executed
  update_project_provisioning(
    xcodeproj: "#{PROJECT_NAME}.xcodeproj",
    target_filter: PROJECT_NAME,
    code_signing_identity: "iPhone Distribution",
    profile: CERTIFICATES_PATH+"AppStore_#{APP_IDENTIFIER}.mobileprovision"
  )
Complete output when running fastlane, including the stack trace and command used
 
$ fastlane test
[✔] 🚀 
[13:13:07]: fastlane detected a Gemfile in the current directory
[13:13:07]: However, it seems like you didn't use `bundle exec`
[13:13:07]: To launch fastlane faster, please use
[13:13:07]: 
[13:13:07]: $ bundle exec fastlane test
[13:13:07]: 
[13:13:07]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[13:13:09]: ------------------------------
[13:13:09]: --- Step: default_platform ---
[13:13:09]: ------------------------------
[13:13:09]: Driving the lane 'ios test' 🚀
[13:13:10]: -----------------------------------------
[13:13:10]: --- Step: update_project_provisioning ---
[13:13:10]: -----------------------------------------
[13:13:10]: You’re updating provisioning profiles directly in your project, but have you considered easier ways to do code signing?
[13:13:10]: https://docs.fastlane.tools/codesigning/GettingStarted/
[13:13:10]: Parsing mobile provisioning profile from '/Users/***/AppStore_***.mobileprovision'
[13:13:10]: Going to update project '***.xcodeproj' with UUID
[13:13:10]: Updating target ***...
[13:13:10]: Updating configuration Debug...
+------------------+----------+
|        Lane Context         |
+------------------+----------+
| DEFAULT_PLATFORM | ios      |
| PLATFORM_NAME    | ios      |
| LANE_NAME        | ios test |
+------------------+----------+

±-----±----------------------------±------------+ | fastlane summary | ±-----±----------------------------±------------+ | Step | Action | Time (in s) | ±-----±----------------------------±------------+ | 💥 | update_project_provisioning | 0 | ±-----±----------------------------±------------+

[13:13:10]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane…

➡️ select_team’: undefined method `[]’ for nil:NilClass (NoMethodError) https://github.com/fastlane/fastlane/issues/20086 [closed] 17 💬 3 weeks ago

➡️ [spaceship][tunes] fix ‘block in select_team’: [!] undefined method `[]’ for nil:NilClass https://github.com/fastlane/fastlane/pull/20088 [closed] 5 💬 3 weeks ago

➡️ [supply] added support for refresh tokens as an authentication method https://github.com/fastlane/fastlane/pull/16414 [open] 10 💬 23 May 2020

and 554 more at: https://github.com/fastlane/fastlane/search?q=undefined method `[]' for nil&type=Issues&utf8=✓

🔗 You can ⌘ + double-click on links to open them directly in your browser. /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/update_project_provisioning.rb:73:in block (2 levels) in run': [!] undefined method []’ for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/update_project_provisioning.rb:57:in each' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/update_project_provisioning.rb:57:in block in run’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/update_project_provisioning.rb:49:in each' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/update_project_provisioning.rb:49:in run’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:263:in block (2 levels) in execute_action' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/actions/actions_helper.rb:69:in execute_action’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:255:in block in execute_action' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:229:in chdir’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:229:in execute_action' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:157:in trigger_action_by_name’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/fast_file.rb:159:in method_missing' from Fastfile:54:in block (2 levels) in parsing_binding’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/lane.rb:33:in call' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:49:in block in execute’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:45:in chdir' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/runner.rb:45:in execute’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/lane_manager.rb:47:in cruise_lane' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/command_line_handler.rb:36:in handle’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/commands_generator.rb:110:in block (2 levels) in run' from /Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:187:in call’ from /Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:157:in run' from /Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in run_active_command’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in run!' from /Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in run!’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/commands_generator.rb:354:in run' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/commands_generator.rb:43:in start’ from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/fastlane/lib/fastlane/cli_tools_distributor.rb:122:in take_off' from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.205.1/bin/fastlane:23:in <top (required)>’ from /usr/local/bin/fastlane:25:in load' from /usr/local/bin/fastlane:25:in <main>’

Environment

✅ fastlane environment ✅

Stack

Key Value
OS 12.3.1
Ruby 2.6.8
Bundler? false
Git git version 2.33.1
Installation Source /usr/local/bin/fastlane
Host macOS 12.3.1 (21E258)
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.3.1
Swift Version 5.6

System Locale

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

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.4.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
plist 3.5.0
addressable 2.8.0
multipart-post 2.0.0
word_wrap 1.0.0
optparse 0.1.1
tty-cursor 0.7.1
tty-spinner 0.9.3
artifactory 3.0.15
colored 1.2
highline 2.0.3
commander 4.6.0
faraday_middleware 1.0.0
gh_inspector 1.1.3
mini_magick 4.10.1
rubyzip 2.3.0
security 0.1.3
xcpretty-travis-formatter 1.0.0
simctl 1.6.8
google-apis-playcustomapp_v1 0.2.0
uber 0.1.0
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
mini_mime 1.0.2
memoist 0.16.2
signet 0.14.0
googleauth 0.17.0
httpclient 2.8.3
webrick 1.4.4
google-apis-core 0.4.1
google-apis-androidpublisher_v3 0.10.0
google-cloud-core 1.5.0
google-apis-iamcredentials_v1 0.3.0
google-apis-storage_v1 0.3.0
google-cloud-storage 1.31.0
rexml 3.2.5
nanaimo 0.3.0
colored2 3.1.2
claide 1.0.3
CFPropertyList 3.0.2
atomos 0.1.3
xcodeproj 1.21.0
unicode-display_width 1.7.0
terminal-table 1.8.0
public_suffix 4.0.6
tty-screen 0.8.1
babosa 1.0.4
excon 0.78.0
unf_ext 0.0.7.7
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.3
ruby2_keywords 0.0.2
faraday 1.1.0
faraday-cookie_jar 0.0.7
fastimage 2.2.0
json 2.3.1
naturally 2.2.1
dotenv 2.7.6
bundler 2.1.4
jwt 2.3.0
declarative 0.0.20
multi_json 1.15.0
os 1.1.1
google-cloud-env 1.4.0
google-cloud-errors 1.0.1
rake 13.0.1
digest-crc 0.6.1
emoji_regex 3.2.1
aws-eventstream 1.1.0
aws-sigv4 1.2.2
aws-partitions 1.393.0
jmespath 1.4.0
aws-sdk-core 3.109.2
aws-sdk-kms 1.39.0
aws-sdk-s3 1.84.1
forwardable 1.3.1
logger 1.3.0
stringio 0.0.2
ipaddr 1.2.2
openssl 2.1.2
ostruct 0.1.0
strscan 1.0.0
date 3.0.1
io-console 0.5.6
fileutils 1.4.1
zlib 1.0.0
libxml-ruby 3.2.1
psych 3.1.0
mutex_m 0.1.0

generated on: 2022-04-13

About this issue

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

Commits related to this issue

Most upvoted comments

I started getting this error this morning. It was working fine the last few days.

why is update_project_provisioning suddenly no longer working? for me, swapping to update_code_signing_settings is not a 1 for 1 change from update_project_provisioning so it’s not a good fix for this issue.

I tried to re-generate provisioning profiles.

  1. Open https://developer.apple.com/account/resources/profiles/list
  2. Select any provisioning profile
  3. Click Edit
  4. Click Save
  5. Repeat 1 ~ 4 for all profiles

rebuilding now, it seems to be working.

Deleting was not required in my case.

I tried to re-generate provisioning profiles.

  1. Open https://developer.apple.com/account/resources/profiles/list
  2. Select any provisioning profile
  3. Click Edit
  4. Click Save
  5. Repeat 1 ~ 4 for all profiles

rebuilding now, it seems to be working.

Deleting was not required in my case.

This worked for us, thanks!

This is my replacement code:

update_code_signing_settings(
    path: ".path/to/project.xcodeproj",
    use_automatic_signing: false,
    team_id: EXPORT_TEAM_ID,
    code_sign_identity: CODESIGNING_IDENTITY,
    profile_name: options[:provisioning_profile_name],
    targets: targets_to_change
  )

We don’t use match for the profiles though.

@BDProject yes. i remove all provisioning profile in apple developer and use match to regenerate the provision profile

same here, the problem is in update_project_provisioning.rb:

    UI.message("Parsing mobile provisioning profile from '#{params[:profile]}'")
    profile = File.read(params[:profile])
    p7 = OpenSSL::PKCS7.new(profile)
    store = OpenSSL::X509::Store.new
    UI.user_error!("Could not find valid certificate at '#{params[:certificate]}'") unless File.size(params[:certificate]) > 0
    cert = OpenSSL::X509::Certificate.new(File.read(params[:certificate]))
    store.add_cert(cert)
    p7.verify([cert], store)
    data = Plist.parse_xml(p7.data)

seems that p7.data is empty, thus data is empty, then below line of code:

build_configuration.build_settings["PROVISIONING_PROFILE"] = data["UUID"]

raise a “undefined method `[]’ for nil:NilClass (NoMethodError)” error.

For me, I didn’t want to update my update_project_provisioning.

I just did the following.

  1. update to latest fastlane
  2. fastlane match nuke distribution
  3. fastlane match appstore

and then let the CI build.

@LifetimeCode you can go the https://developer.apple.com/ login. go to profile remove the problem provision profile and create a new one

Replace

    update_project_provisioning(
      profile: ENV["sigh_#{ENV['PROVIDER_VALUE']}_appstore_profile-path"],
      build_configuration: "Release",
      code_signing_identity: "iPhone Distribution"
    )    

to

    update_code_signing_settings(
      profile_name: "match AppStore " + ENV['PROVIDER_VALUE'],
      build_configurations: "Release",
      code_sign_identity: "iPhone Distribution"
    )

fix my problem.

Hi All,

For those who didn’t have the time to read everything, Apple expired a lot of Provisioning Profiles, here https://stackoverflow.com/questions/71850186/invalid-provisioning-profile-signature-state-error-validation-error-90165/71853423#71853423

Stackoverflow mainly offers manual solutions to reset the expiration date, but with fastlane it can be done as well.

Depending how you have your lane setup, when you run get_provisioning_profile there is a parameter force to renew its expiration date. Most likely better to just do once.

    get_provisioning_profile( # Create or get provisioning profile
      output_path: "./builds",  # change to whatever works for you
      force: true,
      filename: "AppStore_" + ENV["APP_IDENTIFIER"] + ".mobileprovision" # Rename the local provisioning profile
    )

See: https://docs.fastlane.tools/actions/get_provisioning_profile/

> openssl pkcs7 -print_certs -text -in noisivorpelibom.mobileprovision -inform der
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 23 (0x17)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=US, O=Apple Inc., OU=Apple Certification Authority, CN=Apple Root CA
        Validity
            Not Before: Apr 12 17:43:28 2007 GMT
            Not After : Apr 12 17:43:28 2022 GMT
        Subject: C=US, O=Apple Inc., OU=Apple Certification Authority, CN=Apple iPhone Certification Authority
<snip>

Apple’s intermediate certificates used to sign the mobileprovision file expired, best option is to re-generate the provisioning profiles, I suppose. See http://stackoverflow.com/a/71853423

From my previous comment: If one needs to do this manually, does it mean deleting the existing provisioning profile and recreating it on the Apple Developer Portal?

I can confirm that by deleting the existing provisioning profile and recreating it on the Apple Developer Portal solved the issue on my side (for those who use Fastlane with GitHub Actions automation).

I manage dozens of projects, and if deleting profiles one by one is time-consuming, I don’t know if there’s a better way

@yixiangfeng confirm! force: true update all profiles via match helps!

How to use this?

Same how and where to set force to true? Anybody able to share sample code?

    match(
        app_identifier: APP_IDENTIFIERS,
        type: "development",
        output_path: CERTIFICATES_PATH,
        force: true
    )
    match(
        app_identifier: APP_IDENTIFIERS,
        type: "appstore",
        output_path: CERTIFICATES_PATH,
        force: true
    )

@yixiangfeng confirm! force: true update all profiles via match helps!

How to use this?

Added force:true to get_provisioning_profile solved it for us. We followed this guide for the fastlane setup. https://thecodingmachine.github.io/react-native-boilerplate/docs/BetaBuild/#code-signing

Not using update_project_provisioning anymore 🙂

This is my replacement code:

update_code_signing_settings(
    path: ".path/to/project.xcodeproj",
    use_automatic_signing: false,
    team_id: EXPORT_TEAM_ID,
    code_sign_identity: CODESIGNING_IDENTITY,
    profile_name: options[:provisioning_profile_name],
    targets: targets_to_change
  )

We don’t use match for the profiles though.

What parts did you replace exactly? 😃

From my previous comment: If one needs to do this manually, does it mean deleting the existing provisioning profile and recreating it on the Apple Developer Portal?

I can confirm that by deleting the existing provisioning profile and recreating it on the Apple Developer Portal solved the issue on my side (for those who use Fastlane with GitHub Actions automation).

@yixiangfeng confirm! force: true update all profiles via match helps!

This worked fine for me!

@yixiangfeng confirm! force: true update all profiles via match helps!