fastlane icon indicating copy to clipboard operation
fastlane copied to clipboard

Can't upload build to Test Flight; [!] undefined method `refresh!'

Open g1umov opened this issue 2 years ago • 6 comments

New Issue Checklist

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

g1umov avatar Apr 16 '24 13:04 g1umov

we are getting the same

jkester1986 avatar Apr 16 '24 20:04 jkester1986

Same here

st3fus avatar Apr 23 '24 17:04 st3fus

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.

MarkK112 avatar May 08 '24 12:05 MarkK112

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)

dantesarotti avatar Jun 19 '24 13:06 dantesarotti

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.*

nrbrook avatar Jul 23 '24 10:07 nrbrook

The same

juliaplatova avatar Jul 23 '24 12:07 juliaplatova