orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 93 forks source link

NoMethodError - undefined method `upcase' for nil:NilClass #199

Open mvg06 opened 4 years ago

mvg06 commented 4 years ago

Command

/usr/local/bin/pod install

Report

Stack

   CocoaPods : 1.8.4
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.2 (19C57)
       Xcode : 11.2.1 (11B500)
         Git : git version 2.21.0 (Apple Git-122.2)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ b1226b5c2c7cd5253d94edb74495a7a5b851d924
               Pods-Specs-Master - git - git@github.com:mvg06/Pods-Specs-Master.git @ 4d54e0963dbe56a8686f41cc2684f422418343e7
               trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-keys        : 2.1.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

target 'WisePlatform' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for WisePlatform
  pod 'SwiftLint'
  pod 'AWSCore', '~> 2.12.0'
  pod 'AWSMobileClient', '~> 2.12.0'  

  target 'WisePlatformTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'WisePlatformUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

plugin 'cocoapods-keys', {
  :project => 'WisePlatform',
  :keys => [
    'CognitoPoolIdDev',
    'CognitoAppClientIdDev',
    'CognitoRegionDev'
  ]}

Error

NoMethodError - undefined method `upcase' for nil:NilClass
Did you mean?  case
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/keyring.rb:22:in `block in code_name'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/keyring.rb:22:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/keyring.rb:22:in `code_name'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/key_master.rb:13:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/plugin.rb:39:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/plugin.rb:39:in `setup'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.1.0/lib/plugin.rb:11:in `block in singleton class'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:122:in `block (3 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:116:in `block (2 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:115:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:115:in `block in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:114:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:599:in `run_plugins_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:219:in `block in prepare'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:215:in `prepare'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:155:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
1jacobb1 commented 3 years ago

I encountered the same error / problem as well 😞.

bmedenwald commented 3 years ago

Did anyone figure this out? I'm now suffering from the same issue.

MRSorokinMaxim commented 2 years ago

I have the same problem

andyapplaudo commented 9 months ago

Same here! is there any solution? It has been open since 2021 😞

stephenruda commented 3 months ago

There might be several reasons for this issue. I can tell you about my experience and how I solved the problem. In my CI environment, I did something like...

bundle exec pod keys set clientId "\"somedummyvalue\"" "\"ProjectName\""

This ended up setting the key for cocoapods-keys-"ProjectName" instead of cocoapods-keys-ProjectName. This is evidenced by the fact that I would see Saved clientId to "ProjectName". instead of Saved clientId to ProjectName. in the output. Make sure that your output doesn't have any weird characters in it (quotes, dashes, etc). When the script runs, the first character was a " which throws an exception when converting it to uppercase.

However, even after I realized the problem and ran the correct command...

bundle exec pod keys set clientId "somedummyvalue" "ProjectName"

I was still seeing the same issue. Here is how I solved it... 1). bundle exec pod keys rm "*" "ProjectName" This will remove the keys that were added with quotes. I don't know if it is necessary but it is good to clean up the broken stuff first. 2). rm -rf ~/.cocoapods/keys This was the thing that really tripped me up. It seems like something was cached and even after using the correct command it was always still adding the extra quotes. Once I deleted this folder and entered the correct command again, everything worked. You don't have to delete the entire folder if you know exactly which .yml file inside the folder pertains to your particular project.