Can't upload build to Test Flight; [!] undefined method `refresh!'
New Issue Checklist
- [x] Updated fastlane to the latest version
- [x] I read the Contribution Guidelines
- [x] I read docs.fastlane.tools
- [x] I searched for existing GitHub issues
Issue Description
I see the following error message: /opt/homebrew/Cellar/fastlane/2.220.0/libexec/gems/fastlane-2.220.0/spaceship/lib/spaceship/connect_api/api_client.rb:189:in rescue in with_asc_retry': [!] undefined method refresh!' for nil (NoMethodError) @token.refresh!
when I try to upload a build to Test Flight. And fastlane logins to App Store Connect successfully.
I'm using the two-factor authentication method.
Command executed
lane :upload do |options| upload_to_testflight( ipa: ENV['IPA_PATH'], skip_submission: true, skip_waiting_for_build_processing: true, app_identifier: ENV['BUNDLE_IDENTIFIER'] ) end
we are getting the same
Same here
The error message you’re encountering suggests that the @token.refresh! method is undefined. To resolve this, ensure that your authentication token is valid and properly configured. You might need to reauthenticate or check your credentials.
Publix Passport Additionally, consider updating Fastlane to the latest version to address any potential issues.
This has just happened to me at the final stage of a testflight upload for the external group. After the error, the build was uploaded but it was only assigned to the internal group, which is the default group.
This is my lane: lane :int_group do |options| upload_to_testflight( ipa: options[:ipa], uses_non_exempt_encryption: false, ) end
Then I realized that the external group name in Testflight was not the same name that I had configure in my Fastfile so it probably tried to assign a group that didn't exist to this release.
I don't really know if this was the issue and I won't be able to test again until I have a new release to upload, but Fastlane was working fine for other apps I have in the same account with the right group names.
this is the beginning of the error:
[log] bundler: failed to load command: fastlane (/Users/user/.rbenv/versions/3.1.3/bin/fastlane)
[log] /Users/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/fastlane-2.220.0/spaceship/lib/spaceship/connect_api/api_client.rb:189:in rescue in with_asc_retry': [!] undefined method refresh!' for nil:NilClass (NoMethodError)
[log]
[log] @token.refresh!
[log] ^^^^^^^^^
And I found this line in the middle of the stack trace, but it makes little sense to me because the IPA file was actually uploaded for the internal group: [log] /Users/****/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/fastlane-2.220.0/spaceship/lib/spaceship/connect_api/api_client.rb:245:in `handle_error': Authentication credentials are missing or invalid. - No valid credentials found in the request. (Spaceship::UnauthorizedAccessError)
I had the same issue. It looks like a bug in Fastlane to me... But you can work around it by removing your refresh token. Go to Keychain Access and delete all login entries named deliver.*
The same