fastlane: app_store_connect_api_key doesn't work with key_content
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 trying to create an app_store_connect_api_key using key_content upload_to_testflight will result in an error.
However, providing the key with key_filepath does work.
Command executed
app_store_connect_api_key(
in_house: true
)
The rest is set with ENV VARS
Complete output when running fastlane, including the stack trace and command used
/usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/spaceship/lib/spaceship/connect_api/token.rb:57:in `initialize': [!] invalid curve name (OpenSSL::PKey::ECError)
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/spaceship/lib/spaceship/connect_api/token.rb:57:in `new'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/spaceship/lib/spaceship/connect_api/token.rb:57:in `create'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/pilot/lib/pilot/manager.rb:33:in `api_token'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/pilot/lib/pilot/manager.rb:20:in `login'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/pilot/lib/pilot/manager.rb:16:in `start'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/pilot/lib/pilot/build_manager.rb:17:in `upload'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/actions/upload_to_testflight.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
from /usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.161.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
from Fastfile:28:in `block (2 levels) in parsing_binding'
##[error]Bash exited with code '1'.
Finishing: Run Fastlane Deploy
I've tried providing the key with and without line breaks but still it didn't seem to make a difference
Environment
I don't have this, it's running on Azure DevOps
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (7 by maintainers)
Oh wait… I did already comment on this about that OMG
I think I will add a base64 encoded option though because why not
@SEGVeenstra I’m glad
key_filepathworks butkey_contentshould be working too! How are you trying to load it? Are you trying to load it from an environment variable or a string? One thing you will need to make sure that you do is that you keep the new lines (\n) in there.We should actually probably catch this error and spit out something a bit more useful 🤔
I had this issue… I solved it by doing (fastfile - ruby):
That
gsubfunction replaces all\nwith an escaped\\n… I haven’t tested with Azure, but for Github secrets, we pasted the key exactly as we got it from Apple’s developer portal, and I passed it as an ENV variable to Fastlane from Github secrets…Then I invoke the above as the very first thing before my build runs. Finally, I do:
Also, note that
app_store_connect_api_keyis NOT persistent. It must be called before EACH LANE! I tried to have asetup_laneand I called it there… then my other lanes were triggered right after. The other lanes will fail! So I ended up doing: