fastlane: fastlane notarize fails during staple even though the package is approved
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
When I run the fastlane notarize command to upload my .zip file for notarization, notarization succeeds, but fastlane fails with the error “FastlaneCore::Interface::FastlaneShellError: [!] Shell command exited with exit status 66 instead of 0.”
Unfortunately, this bug makes it impossible for me to use Fastlane’s notarize action for my macOS app. 😮(
It looks like xcrun stapler staple fails, or that sh_control_output is trying to invoke a missing method. Just to verify the Xcode version (11.3) is not a problem, I ran xcrun stapler staple, and that appears to work nominally.
One point: I’m uploading a .zip file, which cannot be stapled. Perhaps that is the problem?
Would it make sense to add a skip_staple parameter to the notarize options?
(A larger feature request for another time would be to unzip the .zip file, staple any bundles within it, and re-zip it.)
Command(s) executed
source ~/.bash_profile # add ruby 2.7.x to the PATH
bundle install
notarization_apple_id=${AppleID}
notarization_team_shortname=${TeamShortname}
archive_bundle_id=com.mycompany.SDK-$(cat version.txt).zip
archive_filepath=$(\ls -1 ./artifacts/mycompany-sdk-*-macos.zip | head -1)
export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=${NOTARIZATION_APP_SPECIFIC_PASSWORD}
bundle exec fastlane run notarize package:${archive_filepath} asc_provider:${notarization_team_shortname} username:${notarization_apple_id} bundle_id:${archive_bundle_id} print_log:true
Complete output when running fastlane, including the stack trace and command used
Fastlane would exit immediately if I specified --capture_output. Hopefully, --verbose provides some useful information, though.
[✔] 🚀 DEBUG [2020-11-24 17:46:42.56]: Checking if there are any plugins that should be loaded... Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- DEBUG [2020-11-24 17:46:42.67]: Using package: /Users/user1/Downloads/mycompany-sdk-5.14.0.32807.73d42bff-macos.zip DEBUG [2020-11-24 17:46:42.67]: Using asc_provider: Redacted DEBUG [2020-11-24 17:46:42.67]: Using username: mycompany-ci@redacted.com DEBUG [2020-11-24 17:46:42.67]: Using bundle_id: com.mycompany.SDK.5.14.0.zip Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- Successfully loaded Appfile at path '/Users/user1/Projects/sdk/fastlane/Appfile' ------- INFO [2020-11-24 17:46:42.69]: ---------------------- INFO [2020-11-24 17:46:42.69]: --- Step: notarize --- INFO [2020-11-24 17:46:42.69]: ---------------------- INFO [2020-11-24 17:46:42.69]: Uploading package to notarization service, might take a while INFO [2020-11-24 17:47:52.02]: Successfully uploaded package to notarization service with request identifier [redacted-please DM for a sample; upload and notarization were successful] INFO [2020-11-24 17:47:52.02]: Waiting to query request status INFO [2020-11-24 17:48:22.02]: Querying request status INFO [2020-11-24 17:48:53.19]: Querying request status INFO [2020-11-24 17:49:24.48]: Querying request status INFO [2020-11-24 17:49:26.07]: Stapling packageLooking for related GitHub issues on fastlane/fastlane… Search query: Shell command exited with exit status 66 instead of 0.
URL: https://api.github.com/search/issues?q=Shell command exited with exit status 66 instead of 0.+repo:fastlane/fastlane ➡️ Promo codes https://github.com/fastlane/fastlane/issues/66 [closed] 4 💬 26 Sep 2016
➡️ build_android_app gradle step signingConfigWriterStagingRelease fails after upgrade to React Native 0.60.5 https://github.com/fastlane/fastlane/issues/15233 [closed] 20 💬 19 Dec 2019
➡️ Instead of FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD, fastlane asks for FASTLANE_PASSWORD https://github.com/fastlane/fastlane/issues/15038 [closed] 2 💬 21 Sep 2019
and 17 more at: https://github.com/fastlane/fastlane/search?q=Shell command exited with exit status 66 instead of 0.&type=Issues&utf8=✓
🔗 You can ⌘ + double-click on links to open them directly in your browser. Traceback (most recent call last): 26: from /Users/user1/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in
<main>' 25: from /Users/user1/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:ineval’ 24: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/bin/fastlane:23:in<main>' 23: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/bin/fastlane:23:inload’ 22: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/bin/fastlane:23:in<top (required)>' 21: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:intake_off’ 20: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:41:instart' 19: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:352:inrun’ 18: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:inrun!' 17: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:inrun!’ 16: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:inrun_active_command' 15: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:inrun’ 14: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:incall' 13: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:224:inblock (2 levels) in run’ 12: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/one_off.rb:22:inexecute' 11: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/one_off.rb:42:inrun’ 10: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:inexecute_action' 9: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:inchdir’ 8: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:255:inblock in execute_action' 7: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:inexecute_action’ 6: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:263:inblock (2 levels) in execute_action' 5: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/notarize.rb:107:inrun’ 4: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/notarize.rb:120:instaple' 3: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/helper/sh_helper.rb:12:insh’ 2: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:insh_control_output' 1: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:inmethod_missing’ /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:inshell_error!': Shell command exited with exit status 66 instead of 0. (FastlaneCore::Interface::FastlaneShellError) 26: from /Users/user1/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in<main>’ 25: from /Users/user1/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:ineval' 24: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/bin/fastlane:23:in<main>’ 23: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/bin/fastlane:23:inload' 22: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/bin/fastlane:23:in<top (required)>’ 21: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:intake_off' 20: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:41:instart’ 19: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:352:inrun' 18: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:inrun!’ 17: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:inrun!' 16: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:inrun_active_command’ 15: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:inrun' 14: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:incall’ 13: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:224:inblock (2 levels) in run' 12: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/one_off.rb:22:inexecute’ 11: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/one_off.rb:42:inrun' 10: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:inexecute_action’ 9: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:inchdir' 8: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:255:inblock in execute_action’ 7: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:inexecute_action' 6: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:263:inblock (2 levels) in execute_action’ 5: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/notarize.rb:107:inrun' 4: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/notarize.rb:120:instaple’ 3: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/helper/sh_helper.rb:12:insh' 2: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:insh_control_output’ 1: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:inmethod_missing' /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:inshell_error!': [!] Shell command exited with exit status 66 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
Environment
✅ fastlane environment ✅
Stack
| Key | Value |
|---|---|
| OS | 10.15.7 |
| Ruby | 2.6.3 |
| Bundler? | true |
| Git | git version 2.24.3 (Apple Git-128) |
| Installation Source | ~/Projects/sdk/.gems/bundle/ruby/2.6.0/bin/fastlane |
| Host | Mac OS X 10.15.7 (19H15) |
| Ruby Lib Dir | ~/.rvm/rubies/ruby-2.6.3/lib |
| OpenSSL Version | OpenSSL 1.1.1d 10 Sep 2019 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 11.6 |
System Locale
| Variable | Value | |
|---|---|---|
| LANG | en_US.UTF-8 | ✅ |
| LC_ALL | en_US.UTF-8 | ✅ |
| LANGUAGE |
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
#
platform :ios do
before_all do
update_fastlane
ensure_bundle_exec
end
after_all do
# N/A
end
desc "Install certificates and provisioning profiles for iOS code signing."
lane :install_certs do
match
end
end
platform :mac do
before_all do
update_fastlane
ensure_bundle_exec
end
after_all do
# N/A
end
desc "Install certificates necessary for macOS code signing."
lane :install_certs do
match(type: "developer_id", skip_provisioning_profiles: true)
end
desc "Notarize macOS package with Apple"
lane :notarize_build do |options|
notarize(package: options[:package], )
end
end
`./fastlane/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.168.0 | ✅ Up-To-Date |
Loaded fastlane plugins:
No plugins Loaded
Loaded gems
| Gem | Version |
|---|---|
| did_you_mean | 1.3.0 |
| rake | 13.0.1 |
| CFPropertyList | 3.0.2 |
| public_suffix | 4.0.6 |
| addressable | 2.7.0 |
| atomos | 0.1.3 |
| aws-eventstream | 1.1.0 |
| aws-partitions | 1.399.0 |
| aws-sigv4 | 1.2.2 |
| jmespath | 1.4.0 |
| aws-sdk-core | 3.109.3 |
| aws-sdk-kms | 1.39.0 |
| aws-sdk-s3 | 1.85.0 |
| babosa | 1.0.4 |
| bundler | 2.1.4 |
| claide | 1.0.3 |
| colored | 1.2 |
| colored2 | 3.1.2 |
| highline | 1.7.10 |
| commander-fastlane | 4.4.6 |
| declarative | 0.0.20 |
| declarative-option | 0.1.0 |
| digest-crc | 0.6.1 |
| unf_ext | 0.0.7.7 |
| unf | 0.1.4 |
| domain_name | 0.5.20190701 |
| dotenv | 2.7.6 |
| emoji_regex | 3.2.1 |
| excon | 0.78.0 |
| multipart-post | 2.0.0 |
| ruby2_keywords | 0.0.2 |
| faraday | 1.1.0 |
| http-cookie | 1.0.3 |
| faraday-cookie_jar | 0.0.7 |
| faraday_middleware | 1.0.0 |
| fastimage | 2.2.0 |
| gh_inspector | 1.1.3 |
| jwt | 2.2.2 |
| memoist | 0.16.2 |
| multi_json | 1.15.0 |
| os | 1.1.1 |
| signet | 0.14.0 |
| googleauth | 0.14.0 |
| httpclient | 2.8.3 |
| mini_mime | 1.0.2 |
| uber | 0.1.0 |
| representable | 3.0.4 |
| retriable | 3.1.2 |
| google-api-client | 0.38.0 |
| google-cloud-env | 1.4.0 |
| google-cloud-errors | 1.0.1 |
| google-cloud-core | 1.5.0 |
| google-cloud-storage | 1.29.1 |
| json | 2.3.1 |
| mini_magick | 4.11.0 |
| plist | 3.5.0 |
| rubyzip | 2.3.0 |
| security | 0.1.3 |
| naturally | 2.2.0 |
| simctl | 1.6.8 |
| slack-notifier | 2.3.2 |
| terminal-notifier | 2.0.0 |
| unicode-display_width | 1.7.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.19.0 |
| rouge | 2.0.7 |
| xcpretty | 0.3.0 |
| xcpretty-travis-formatter | 1.0.0 |
generated on: 2020-11-24
Additional details
The package was successfully notarized, despite the fastlane failure! (So re-attempting with the same bundle_id would fail.)
altool output
$ xcrun altool --notarization-info redacted --username mycompany-ci@redacted.com --password "@keychain:Notarization Password" No errors getting notarization info.Date: 2020-11-24 22:47:51 +0000 Hash: 62d33fc72d7abd9d6f22b90c4cca2121a13c25564ad8d90f456c01c691c24378 LogFileURL: redactedRequestUUID: redacted-please DM for a sample Status: success Status Code: 0 Status Message: Package Approved
🔨 Xcode version info
Selected Xcode: /Applications/Xcode11.3.app Xcode : 11C29
$ xcodebuild -showsdks iOS SDKs: iOS 13.2 -sdk iphoneos13.2 iOS Simulator SDKs: Simulator - iOS 13.2 -sdk iphonesimulator13.2 macOS SDKs: DriverKit 19.0 -sdk driverkit.macosx19.0 macOS 10.15 -sdk macosx10.15 tvOS SDKs: tvOS 13.2 -sdk appletvos13.2 tvOS Simulator SDKs: Simulator - tvOS 13.2 -sdk appletvsimulator13.2 watchOS SDKs: watchOS 6.1 -sdk watchos6.1 watchOS Simulator SDKs: Simulator - watchOS 6.1 -sdk watchsimulator6.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (2 by maintainers)
Commits related to this issue
- #17667 Added optional `skip_stapling` parameter to `notarize` action. — committed to macblazer/fastlane by macblazer 3 years ago
- #17667 Added optional `skip_stapling` parameter to `notarize` action. (#19577) — committed to fastlane/fastlane by macblazer 3 years ago
Added to my queue!
I will work on updating the notarize command to add a
skip_staplingparameter which will do what it says. This is useful for notarizing single-file executables which cannot be stapled (which is the usual reason for using zip).I ran
fastlane notarizewithprint_log:true verbose:true, and got this output. It is definitely trying to staple the .zip file, which is not valid.`fastlane notarize` output 🪵
The above was tested with Fastlane 2.187.0, Xcode 12.5.1, and Ruby 3.0.0.
So my original diagnosis is correct. The
fastlane notarizecommand is broken for .zip files–it successfully uploads and notarizes them, but then exits with nonzero status because it incorrectly tries to staple the notarization ticket to a .zip file. I presume it works for .pkg and .dmg files then?The simplest solution is to make the
notarizecommand smarter so it does not try (and fail) to staple a .zip file.A more advanced solution would be to add an option to unzip the .zip file, search for and staple all of the bundles within, and then re-zip the contents. (I imagine some users would not want their .zip file altered, while others would find it convenient to re-zip with stapled tickets in place.)