Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastlane deliver init is not working in CLI #21960

Open
gurtejsmartdata opened this issue Apr 9, 2024 · 1 comment
Open

fastlane deliver init is not working in CLI #21960

gurtejsmartdata opened this issue Apr 9, 2024 · 1 comment

Comments

@gurtejsmartdata
Copy link

What is an issue ?
We are trying fastlane deliver init command and it is throwing following error
[!] 'api_key' value must be a Hash! Found String instead.

fastlane env details

`

✅ fastlane environment ✅

Stack

Key Value
OS 13.0
Ruby 3.3.0
Bundler? false
Git git version 2.37.1 (Apple Git-137.1)
Installation Source /opt/homebrew/Cellar/fastlane/2.220.0/libexec/bin/fastlane
Host macOS 13.0 (22A380)
Ruby Lib Dir /opt/homebrew/Cellar/ruby/3.3.0/lib
OpenSSL Version OpenSSL 3.2.0 23 Nov 2023
Is contained false
Is homebrew true
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 14.1
Swift Version 5.7.1

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
require 'dotenv/load'
import './lanes/lane_files_to_replace.rb'
import './lanes/lane_replace_identifier_in_file.rb'
import './lanes/lane_produce_ios_app.rb'
import './lanes/lane_setup_env_methods.rb'
import './lanes/lane_update_bundle_identifiers_ios.rb'
import './lanes/lane_increment_build_version_ios.rb'
import './lanes/lane_update_app_group_identifiers.rb'
import './lanes/lane_copy_assests_ios.rb'
import './lanes/lane_upload_to_appcenter_ios.rb'
import './lanes/lane_update_plist_value_ios.rb'
import './lanes/lane_copy_assests_android.rb'
import './lanes/lane_increment_build_version_android.rb'
import './lanes/lane_update_android_strings_android.rb'
import './lanes/lane_build_ios.rb'
import './lanes/lane_build_android.rb'
import './lanes/lane_upload_to_appcenter_android.rb'
import './lanes/lane_whats_new_text.rb'
import './lanes/lane_notify_slack.rb'
import './lanes/lane_deliver_ios.rb'
lane :prepare_build do |options|
  setup_env(unique_whitelabel_id:options[:unique_whitelabel_id])
  deliver_ios
  # configure_project(options[:unique_whitelabel_id])
  # configure_ios(options[:bump_type])
  # build_ios
  # upload_to_appcenter_ios
  # configure_android(options[:bump_type])
  # build_android
  # upload_to_appcenter_android
  #notify_slack
end
def configure_project(unique_whitelabel_id)
  # Path to your new splash screen folder
  img_source_directory = "./whitelabels/#{unique_whitelabel_id}/assets/img/"
  # Path to your destination splash screen folder
  img_destination_directory = "../src/assets/img"
  sh "cp -r #{img_source_directory} #{img_destination_directory}"
end
###############################################Setup iOS########################################################
def configure_ios(bump_type)
  project_identifiers=   ([
    ENV["BUNDLE_IDENTIFIER"],
    "#{ENV["BUNDLE_IDENTIFIER"]}.OneSignalNotificationServiceExtension", 
    "#{ENV["BUNDLE_IDENTIFIER"]}.watchkitapp",
    "#{ENV["BUNDLE_IDENTIFIER"]}.watchkitapp.watchkitextension",
    "#{ENV["BUNDLE_IDENTIFIER"]}.widgets",
    "#{ENV["BUNDLE_IDENTIFIER"]}.siriKit",
    "#{ENV["BUNDLE_IDENTIFIER"]}.IntentHandler"]
    )
  xcodeproj_path = "./ios/#{ENV["XCODE_PROJECT_NAME"]}.xcodeproj"
  testproj_path="./ios/#{ENV["XCODE_PROJECT_NAME"]}Tests."
  security_application_group="group.#{ENV["BUNDLE_IDENTIFIER"]}.widget"

  api_key_store=app_store_connect_api_key(
    key_id: ENV["APP_STORE_CONNECT_API_KEY"],
    issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
    key_filepath: "fastlane/whitelabels/#{ENV["UNIQUE_WHITELABEL_ID"]}/AuthKey_TT5ZPA29J7.p8"
  )
  update_bundle_identifiers_ios(xcodeproj_path:xcodeproj_path)
  increment_build_version_ios(bump_type:bump_type)
  replace_identifier_in_file()
  update_plist_value_ios(xcodeproj_path:xcodeproj_path)
  ios_update_app_group_identifiers
  copy_ios_assests()
 produce_ios_app(bundle_identifiers:project_identifiers)
  match(
    type: "appstore",
    username: ENV["APPSTORE_USER"],
    app_identifier: project_identifiers,
    api_key: api_key_store
  )
end
def configure_android(bump_type)
copy_android_assests()
increment_build_version_android(bump_type:bump_type)
update_android_strings_android()
end

No Appfile found

fastlane gems

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

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-appcenter 2.1.2 ✅ Up-To-Date
fastlane-plugin-appicon 0.16.0 ✅ Up-To-Date
fastlane-plugin-versioning 0.5.2 ✅ Up-To-Date
fastlane-plugin-versioning_android 0.1.1 ✅ Up-To-Date
fastlane-plugin-update_android_strings 0.1.0 ✅ Up-To-Date
fastlane-plugin-universal_metadata 0.1.1 ✅ Up-To-Date
Loaded gems
Gem Version
error_highlight 0.6.0
did_you_mean 1.6.3
syntax_suggest 2.0.0
public_suffix 5.0.5
addressable 2.8.6
artifactory 3.0.17
jmespath 1.6.2
aws-partitions 1.907.0
aws-eventstream 1.3.0
aws-sigv4 1.8.0
aws-sdk-core 3.191.6
aws-sdk-kms 1.78.0
aws-sdk-s3 1.146.1
babosa 1.0.4
bundler 2.5.4
rexml 3.2.6
nkf 0.1.3
base64 0.2.0
CFPropertyList 3.0.7
colored 1.2
highline 2.0.3
commander 4.6.0
dotenv 2.8.1
emoji_regex 3.2.3
excon 0.110.0
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.4.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.3
faraday_middleware 1.2.0
domain_name 0.6.20240107
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
fastimage 2.3.1
gh_inspector 1.1.3
uber 0.1.0
declarative 0.0.20
trailblazer-option 0.1.2
representable 3.2.0
retriable 3.1.2
mini_mime 1.1.5
jwt 2.8.1
multi_json 1.15.0
os 1.1.4
signet 0.19.0
googleauth 1.8.1
httpclient 2.8.3
google-apis-core 0.11.3
google-apis-androidpublisher_v3 0.54.0
google-apis-playcustomapp_v1 0.13.0
google-cloud-env 1.6.0
google-cloud-errors 1.4.0
google-cloud-core 1.7.0
google-apis-iamcredentials_v1 0.17.0
google-apis-storage_v1 0.31.0
rake 13.2.0
digest-crc 0.6.5
google-cloud-storage 1.47.0
json 2.7.1
mini_magick 4.12.0
naturally 2.2.1
optparse 0.4.0
plist 3.7.1
rubyzip 2.3.2
security 0.1.5
simctl 1.6.10
terminal-notifier 2.0.0
unicode-display_width 2.5.0
terminal-table 3.0.2
tty-screen 0.8.2
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
atomos 0.1.3
claide 1.1.0
colored2 3.1.2
nanaimo 0.3.0
xcodeproj 1.24.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
set 1.1.0
forwardable 1.3.3
logger 1.6.0
pathname 0.3.0
shellwords 0.2.0
cgi 0.4.1
date 3.3.4
timeout 0.4.1
securerandom 0.3.1
uri 0.13.0
openssl 3.2.0
digest 3.1.1
ipaddr 1.2.6
resolv 0.3.0
time 0.3.0
stringio 3.1.0
open-uri 0.4.1
mutex_m 0.2.0
net-http 0.4.0
net-protocol 0.2.2
ostruct 0.6.0
english 0.8.0
erb 4.0.3
abbrev 0.1.2
tempfile 0.2.1
delegate 0.3.1
fileutils 1.7.2
tmpdir 0.2.0
singleton 0.2.0
open3 0.2.1
prettyprint 0.2.0
pp 0.5.0
find 0.2.0
yaml 0.3.0
psych 5.1.2
ox 2.14.18
fastlane-plugin-appcenter 2.1.2
csv 3.2.8
fastlane-plugin-appicon 0.16.0
benchmark 0.3.0
fastlane-plugin-versioning 0.5.2
fastlane-plugin-versioning_android 0.1.1
fastlane-plugin-update_android_strings 0.1.0
fastlane-plugin-universal_metadata 0.1.1

generated on: 2024-04-09

`
@patrick521f
Copy link

patrick521f commented May 8, 2024

Hello,

The error you’re encountering with the fastlane deliver init command indicates that the api_key parameter is expected to be a Hash, but a String was provided instead. This is a common issue when the API key is not formatted correctly in your Fastfile or environment variables.

Here’s how you can resolve this issue:

Format the API Key as a Hash: The api_key should be provided as a Hash object. If you’re defining it in your Fastfile, it should look something like this:

app_store_connect_api_key(
key_id: "YOUR_KEY_ID",
issuer_id: "YOUR_ISSUER_ID",
key_filepath: "path/to/your/key.p8", AARP Mahjongg Candy
in_house: false # true for enterprise accounts, false for individual accounts
)

Use a JSON File: Alternatively, you can create a JSON file containing your API key details and reference it in your Fastfile. The JSON file should have the following format:

{
"key_id": "YOUR_KEY_ID",
"issuer_id": "YOUR_ISSUER_ID",
"key": "-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY\n-----END PRIVATE KEY-----",
"is_in_house": false
}

I hope it's helpful for you.

Best Regard,
patrick521f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants