fastlane: fastlane notarize fails during staple even though the package is approved

New Issue Checklist

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 package

Looking 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:in eval’ 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:in load’ 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:in take_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:in start' 19: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:352:in run’ 18: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in run!' 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:in run!’ 16: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in run_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:in run’ 14: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in call' 13: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:224:in block (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:in execute' 11: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/one_off.rb:42:in run’ 10: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:in execute_action' 9: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:in chdir’ 8: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:255:in block 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:in execute_action’ 6: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:263:in block (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:in run’ 4: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/notarize.rb:120:in staple' 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:in sh’ 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:in sh_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:in method_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:in shell_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:in eval' 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:in load' 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:in take_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:in start’ 19: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:352:in run' 18: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in run!’ 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:in run!' 16: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in run_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:in run' 14: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in call’ 13: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/commands_generator.rb:224:in block (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:in execute’ 11: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/one_off.rb:42:in run' 10: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:in execute_action’ 9: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:229:in chdir' 8: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:255:in block 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:in execute_action' 6: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/runner.rb:263:in block (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:in run' 4: from /Users/user1/Projects/sdk/.gems/bundle/ruby/2.6.0/gems/fastlane-2.168.0/fastlane/lib/fastlane/actions/notarize.rb:120:in staple’ 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:in sh' 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:in sh_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:in method_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:in shell_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: redacted

RequestUUID: 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

Most upvoted comments

Added to my queue!

I will work on updating the notarize command to add a skip_stapling parameter 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 notarize with print_log:true verbose:true, and got this output. It is definitely trying to staple the .zip file, which is not valid.

`fastlane notarize` output 🪵
$ bundle exec fastlane run notarize package:artifacts/mypackage.zip asc_provider:provider_redacted username:AppleID_redacted bundle_id:com.mycopmany.mypackage-1.0.zip print_log:true verbose:true
[✔] 🚀 
[15:39:13]: ----------------------
[15:39:13]: --- Step: notarize ---
[15:39:13]: ----------------------
[15:39:13]: Uploading package to notarization service, might take a while
[15:39:13]: $ xcrun altool --notarize-app -t osx -f "artifacts/mypackage.zip" --primary-bundle-id com.mycopmany.mypackage-1.0.zip --output-format xml --asc-provider "provider_redacted" -u AppleID_redacted -p @env:FL_NOTARIZE_PASSWORD
[15:39:14]: ▸ 2021-07-13 15:39:14.003 altool[89629:22915987] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called
[15:40:28]: ▸ <?xml version="1.0" encoding="UTF-8"?>
[15:40:28]: ▸ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
[15:40:28]: ▸ <plist version="1.0">
[15:40:28]: ▸ <dict>
[15:40:28]: ▸ <key>notarization-upload</key>
[15:40:28]: ▸ <dict>
[15:40:28]: ▸ <key>RequestUUID</key>
[15:40:28]: ▸ <string>UUID_redacted</string>
[15:40:28]: ▸ </dict>
[15:40:28]: ▸ <key>os-version</key>
[15:40:28]: ▸ <string>10.16.0</string>
[15:40:28]: ▸ <key>success-message</key>
[15:40:28]: ▸ <string>No errors uploading 'artifacts/mypackage.zip'.</string>
[15:40:28]: ▸ <key>tool-path</key>
[15:40:28]: ▸ <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
[15:40:28]: ▸ <key>tool-version</key>
[15:40:28]: ▸ <string>4.01.1182</string>
[15:40:28]: ▸ </dict>
[15:40:28]: ▸ </plist>
[15:40:28]: Successfully uploaded package to notarization service with request identifier UUID_redacted
[15:40:28]: Waiting to query request status
[15:40:58]: Querying request status
[15:40:58]: $ xcrun altool --notarization-info UUID_redacted --output-format xml -u AppleID_redacted -p @env:FL_NOTARIZE_PASSWORD
[15:40:59]: ▸ 2021-07-13 15:40:59.091 altool[89720:22917699] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called
[15:41:00]: ▸ <?xml version="1.0" encoding="UTF-8"?>
[15:41:00]: ▸ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
[15:41:00]: ▸ <plist version="1.0">
[15:41:00]: ▸ <dict>
[15:41:00]: ▸ <key>notarization-info</key>
[15:41:00]: ▸ <dict>
[15:41:00]: ▸ <key>Date</key>
[15:41:00]: ▸ <date>2021-07-13T19:40:29Z</date>
[15:41:00]: ▸ <key>Hash</key>
[15:41:00]: ▸ <string>hash_redacted</string>
[15:41:00]: ▸ <key>RequestUUID</key>
[15:41:00]: ▸ <string>UUID_redacted</string>
[15:41:00]: ▸ <key>Status</key>
[15:41:00]: ▸ <string>in progress</string>
[15:41:00]: ▸ </dict>
[15:41:00]: ▸ <key>os-version</key>
[15:41:00]: ▸ <string>10.16.0</string>
[15:41:00]: ▸ <key>success-message</key>
[15:41:00]: ▸ <string>No errors getting notarization info.</string>
[15:41:00]: ▸ <key>tool-path</key>
[15:41:00]: ▸ <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
[15:41:00]: ▸ <key>tool-version</key>
[15:41:00]: ▸ <string>4.01.1182</string>
[15:41:00]: ▸ </dict>
[15:41:00]: ▸ </plist>
[15:41:30]: Querying request status
[15:41:30]: $ xcrun altool --notarization-info UUID_redacted --output-format xml -u AppleID_redacted -p @env:FL_NOTARIZE_PASSWORD
[15:41:30]: ▸ 2021-07-13 15:41:30.216 altool[89724:22917907] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called
[15:41:31]: ▸ <?xml version="1.0" encoding="UTF-8"?>
[15:41:31]: ▸ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
[15:41:31]: ▸ <plist version="1.0">
[15:41:31]: ▸ <dict>
[15:41:31]: ▸ <key>notarization-info</key>
[15:41:31]: ▸ <dict>
[15:41:31]: ▸ <key>Date</key>
[15:41:31]: ▸ <date>2021-07-13T19:40:29Z</date>
[15:41:31]: ▸ <key>Hash</key>
[15:41:31]: ▸ <string>hash_redacted</string>
[15:41:31]: ▸ <key>RequestUUID</key>
[15:41:31]: ▸ <string>UUID_redacted</string>
[15:41:31]: ▸ <key>Status</key>
[15:41:31]: ▸ <string>in progress</string>
[15:41:31]: ▸ </dict>
[15:41:31]: ▸ <key>os-version</key>
[15:41:31]: ▸ <string>10.16.0</string>
[15:41:31]: ▸ <key>success-message</key>
[15:41:31]: ▸ <string>No errors getting notarization info.</string>
[15:41:31]: ▸ <key>tool-path</key>
[15:41:31]: ▸ <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
[15:41:31]: ▸ <key>tool-version</key>
[15:41:31]: ▸ <string>4.01.1182</string>
[15:41:31]: ▸ </dict>
[15:41:31]: ▸ </plist>
[15:42:01]: Querying request status
[15:42:01]: $ xcrun altool --notarization-info UUID_redacted --output-format xml -u AppleID_redacted -p @env:FL_NOTARIZE_PASSWORD
[15:42:01]: ▸ 2021-07-13 15:42:01.286 altool[89738:22918296] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called
[15:42:02]: ▸ <?xml version="1.0" encoding="UTF-8"?>
[15:42:02]: ▸ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
[15:42:02]: ▸ <plist version="1.0">
[15:42:02]: ▸ <dict>
[15:42:02]: ▸ <key>notarization-info</key>
[15:42:02]: ▸ <dict>
[15:42:02]: ▸ <key>Date</key>
[15:42:02]: ▸ <date>2021-07-13T19:40:29Z</date>
[15:42:02]: ▸ <key>Hash</key>
[15:42:02]: ▸ <string>hash_redacted</string>
[15:42:02]: ▸ <key>LogFileURL</key>
[15:42:02]: ▸ <string>URL_redacted</string>
[15:42:02]: ▸ <key>RequestUUID</key>
[15:42:02]: ▸ <string>UUID_redacted</string>
[15:42:02]: ▸ <key>Status</key>
[15:42:02]: ▸ <string>success</string>
[15:42:02]: ▸ <key>Status Code</key>
[15:42:02]: ▸ <integer>0</integer>
[15:42:02]: ▸ <key>Status Message</key>
[15:42:02]: ▸ <string>Package Approved</string>
[15:42:02]: ▸ </dict>
[15:42:02]: ▸ <key>os-version</key>
[15:42:02]: ▸ <string>10.16.0</string>
[15:42:02]: ▸ <key>success-message</key>
[15:42:02]: ▸ <string>No errors getting notarization info.</string>
[15:42:02]: ▸ <key>tool-path</key>
[15:42:02]: ▸ <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
[15:42:02]: ▸ <key>tool-version</key>
[15:42:02]: ▸ <string>4.01.1182</string>
[15:42:02]: ▸ </dict>
[15:42:02]: ▸ </plist>
[15:42:02]: Stapling package
[15:42:02]: $ xcrun stapler staple "artifacts/mypackage.zip"
[15:42:05]: ▸ Processing: /absolute/path/to/artifacts/mypackage.zip
[15:42:05]: ▸ Stapler is incapable of working with ZIP archive files.

Looking for related GitHub issues on fastlane/fastlane…

bundler: failed to load command: fastlane (/absolute/path/to/.gems/bundle/ruby/2.6.0/bin/fastlane) FastlaneCore::Interface::FastlaneShellError: [!] Exit status of command ‘xcrun stapler staple “artifacts/mypackage.zip”’ was 66 instead of 0. Processing: /absolute/path/to/artifacts/mypackage.zip Stapler is incapable of working with ZIP archive files.

/absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in shell_error!' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in method_missing’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:in sh_control_output' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/helper/sh_helper.rb:12:in sh’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/actions/notarize.rb:127:in staple' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/actions/notarize.rb:114:in run’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/runner.rb:263:in block (2 levels) in execute_action' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in execute_action’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/runner.rb:255:in block in execute_action' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/runner.rb:229:in chdir’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/runner.rb:229:in execute_action' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/one_off.rb:42:in run’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/one_off.rb:22:in execute' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/commands_generator.rb:225:in block (2 levels) in run’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:187:in call' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:157:in run’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in run_active_command' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in run!’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in run!' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/commands_generator.rb:353:in run’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/commands_generator.rb:42:in start' /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/fastlane/lib/fastlane/cli_tools_distributor.rb:122:in take_off’ /absolute/path/to/.gems/bundle/ruby/2.6.0/gems/fastlane-2.187.0/bin/fastlane:23:in <top (required)>' /absolute/path/to/.gems/bundle/ruby/2.6.0/bin/fastlane:23:in load’ /absolute/path/to/.gems/bundle/ruby/2.6.0/bin/fastlane:23:in `<top (required)>’

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 notarize command 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 notarize command 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.)