I’m getting:
Could not configure Apple Service authentication: 2FA session saved in Bitrise Developer Connection is expired, was valid until 2021-09-23 02:01:47 +0000 UTC
So I just created a new 2FA session:
And I still get the same error!
What am I doing wrong?
I’d also appreciate some help with this, so here’s a bump. I had to change the Apple ID as well, but the 2FA was asked and updated. Am I missing something?
Hello,
When you added your Apple ID authentication information (under account/profile settings), you entered the 2FA code. This expires every 30 days so you need to go back to that definition and re-authenticate. Click on the 3 dots to the right and select “Re-authenticate”
opened 01:37PM - 18 Oct 21 UTC
### Troubleshooting
- [x] I've searched [discuss.bitrise.io](https://discuss.… bitrise.io/) for possible solutions.
- Which version of the step is effected? 2.1.1
- Is the issue reproducible with the latest version? YES
- Does the issue happen sporadically, or every time? EVERY TIME
- Is the issue reproducible locally by following our [local debug guide](https://devcenter.bitrise.io/troubleshooting/debugging-your-build-on-your-own-machine/)? YES
### Issue description
Hi, long time Bitrise user, first time issue poster. Tried to investigate as much as I could before opening the issue and fill in the template as best as I could, but happy to answer any remaining questions.
We have an internal alpha version of our app (Pocket) which is available through AppCenter Distribute. We have automatic in-app updates turned on for this alpha channel. So you install it from an AppCenter page once and later get in-app prompts when a new version is available and the AppCenter SDK has an in-app downloader an updater. It's been broken for us since updating the `appcenter-deploy-android` step from 1.X to 2.X.
Since version 2.0.0 and the big migration to the new AppCenter API, there's one tiny thing missing in your implementation of the multistep APK upload procedure. When sending the `set_metadata` request, you're not setting the content type required for APKs. This confuses the AppCenter updater into thinking the downloaded file is not an APK.
<details>
(It is a fully valid APK, manually downloading and installing the APK works beautifully. So AppCenter could in theory fix it on their side, but they haven't been receptive to this in the past. If the issue is not reproducible using AppCenter portal or AppCenter CLI they ask to fix it in the tool that uploads the APK "the wrong way". See microsoft/appcenter-sdk-android/issues/1499)
</details>
* Here's the official migration guide for the new release upload API, where it mentions setting `application/vnd.android.package-archive` as content type for Android apps: https://docs.microsoft.com/en-us/appcenter/distribution/uploading#upload-new-release (See under "Upload New Release" item "2.")
* Here's the line of code in the official AppCenter CLI that's setting the content type (in Typescript): https://github.com/microsoft/appcenter-cli/blob/2f26529fa8495d2fb74146a7834dbd1c201db791/appcenter-file-upload-client-node/src/ac-fus-uploader.ts#L518
* Here's the line of code in `appcenter-deploy-android` step where you send the `set_metadata` request without `content_type` param: https://github.com/bitrise-steplib/steps-appcenter-deploy-android/blob/master/vendor/github.com/bitrise-io/appcenter/client/api.go#L335
I've reproduced the issue locally using Bitrise CLI. I've also confirmed that adding the content type fixes in-app updates in our alpha app, by using this forked version of the step: https://github.com/Pocket/steps-appcenter-deploy-android/pull/1
So I kind of know how to fix it, but I'm pretty sure what I did in the PR above is wrong. Since I probably shouldn't be editing files in the `vendor` subfolder. I think the correct way is to send a PR to the AppCenter shared package to optionally allow specifying the content type. Then in the Android step we could use that to specify `application/vnd.android.package-archive`. I'd be happy to send the shared package PR, but since I've never written a line of Go and have no idea what I'm doing, you'd have to guide me how to update the shared package dependency in the Android step.
### Bitrise info
- Build URL: https://app.bitrise.io/build/b65d155f-0075-4bfe-a4fa-518b69fcdc3c#?tab=log
- [Bitrise Support](https://devcenter.bitrise.io/troubleshooting/enabling-bitrise-support-user/) enabled: YES (11/2/2021)
- Log:
<details>
<pre>
+------------------------------------------------------------------------------+
| (7) appcenter-deploy-android@2 |
+------------------------------------------------------------------------------+
| id: appcenter-deploy-android |
| version: 2.1.1 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: go |
| time: 2021-10-14T13:27:51Z |
+------------------------------------------------------------------------------+
| |
Config:
- Debug: true
- AppPath: /bitrise/deploy/Pocket-teamA-teamRelease.apk
- AppName: Android-Alpha-Team-Only
- APIToken: *****
- OwnerName: pocket-app
- Mandatory: false
- MappingPath: /bitrise/deploy/Pocket-mapping.txt
- ReleaseNotes: https://app.bitrise.io/build/b65d155f-0075-4bfe-a4fa-518b69fcdc3c
- NotifyTesters: false
- DistributionGroup: All-users-of-Android-Alpha-Team-Only
- DistributionStore:
- DistributionTester:
Uploading binary
2021/10/14 13:27:52 [DEBUG] POST https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/uploads/releases
Asset release ID: de472432-fc0d-4a2b-abf5-9daeecdcac83
File asset ID: 51511bfc-84cd-48ea-9b2f-2b0d96cb2116
Uploading file with metadata:
- File name: Pocket-teamA-teamRelease.apk
- File size: 12084951
2021/10/14 13:27:53 [DEBUG] POST https://file.appcenter.ms/upload/set_metadata/51511bfc-84cd-48ea-9b2f-2b0d96cb2116?file_name=Pocket-teamA-teamRelease.apk&file_size=12084951&token=%3fsv%3d2019-02-02%26sr%3dc%26si%3d51511bfc-84cd-48ea-9b2f-2b0d96cb2116%26sig%3dpH7kQpijO%252BzIpeWgT5e0YWW%252Fekof52ahY%252FSclO3OR%252FY%253D%26se%3d2021-10-19T13%253A32%253A53Z%26t%3ddistribution
Upload information:
Chunk size: 4194304 bytes
Chunk number: 3
Uploading chunks ...
Uploading chunk with ID: 3, size: 3696343
Uploading chunk with ID: 1, size: 4194304
Uploading chunk with ID: 2, size: 4194304
2021/10/14 13:27:53 [DEBUG] POST https://file.appcenter.ms/upload/upload_chunk/51511bfc-84cd-48ea-9b2f-2b0d96cb2116?block_number=1&token=%3fsv%3d2019-02-02%26sr%3dc%26si%3d51511bfc-84cd-48ea-9b2f-2b0d96cb2116%26sig%3dpH7kQpijO%252BzIpeWgT5e0YWW%252Fekof52ahY%252FSclO3OR%252FY%253D%26se%3d2021-10-19T13%253A32%253A53Z%26t%3ddistribution
2021/10/14 13:27:53 [DEBUG] POST https://file.appcenter.ms/upload/upload_chunk/51511bfc-84cd-48ea-9b2f-2b0d96cb2116?block_number=2&token=%3fsv%3d2019-02-02%26sr%3dc%26si%3d51511bfc-84cd-48ea-9b2f-2b0d96cb2116%26sig%3dpH7kQpijO%252BzIpeWgT5e0YWW%252Fekof52ahY%252FSclO3OR%252FY%253D%26se%3d2021-10-19T13%253A32%253A53Z%26t%3ddistribution
2021/10/14 13:27:53 [DEBUG] POST https://file.appcenter.ms/upload/upload_chunk/51511bfc-84cd-48ea-9b2f-2b0d96cb2116?block_number=3&token=%3fsv%3d2019-02-02%26sr%3dc%26si%3d51511bfc-84cd-48ea-9b2f-2b0d96cb2116%26sig%3dpH7kQpijO%252BzIpeWgT5e0YWW%252Fekof52ahY%252FSclO3OR%252FY%253D%26se%3d2021-10-19T13%253A32%253A53Z%26t%3ddistribution
Uploading finished, ID: 1
Uploading finished, ID: 3
Uploading finished, ID: 2
Chunk upload finished...
2021/10/14 13:27:54 [DEBUG] POST https://file.appcenter.ms/upload/finished/51511bfc-84cd-48ea-9b2f-2b0d96cb2116?token=%3fsv%3d2019-02-02%26sr%3dc%26si%3d51511bfc-84cd-48ea-9b2f-2b0d96cb2116%26sig%3dpH7kQpijO%252BzIpeWgT5e0YWW%252Fekof52ahY%252FSclO3OR%252FY%253D%26se%3d2021-10-19T13%253A32%253A53Z%26t%3ddistribution
Upload finished...
2021/10/14 13:27:54 [DEBUG] PATCH https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/uploads/releases/de472432-fc0d-4a2b-abf5-9daeecdcac83
Release patched...
Waiting for the AppCenter release to getting ready...
Attempt(s): 1
2021/10/14 13:27:54 [DEBUG] GET https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/uploads/releases/de472432-fc0d-4a2b-abf5-9daeecdcac83
Waiting for 9 second(s), current status: uploadFinished
Attempt(s): 2
2021/10/14 13:28:04 [DEBUG] GET https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/uploads/releases/de472432-fc0d-4a2b-abf5-9daeecdcac83
Release created with ID: 1520
2021/10/14 13:28:04 [DEBUG] GET https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/releases/1520
- Done
Setting distribution group(s)
2021/10/14 13:28:04 [DEBUG] GET https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/distribution_groups/All-users-of-Android-Alpha-Team-Only
2021/10/14 13:28:04 [DEBUG] POST https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/releases/1520/groups
Uploading mapping file
2021/10/14 13:28:04 [DEBUG] POST https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/symbol_uploads
2021/10/14 13:28:04 [DEBUG] PUT https://hogwartsprodsymbols01.blob.core.windows.net:443/hwprodapp-b4fa464f-df00-4d4e-978d-8b121e0291af/upload-00562390-0315-1356-b12d-01e5c5964cd7?st=2021-10-14T13%3A13%3A04Z&se=2021-10-15T13%3A28%3A04Z&sp=w&sv=2018-03-28&sr=b&sig=NHrJaF03gaXfEyUaDDsov%2F%2FGLSse8As4xHrIcicQPmU%3D
2021/10/14 13:28:05 [DEBUG] PATCH https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/symbol_uploads/00562390-0315-1356-b12d-01e5c5964cd7
- Done
Setting release notes
2021/10/14 13:28:05 [DEBUG] PUT https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/releases/1520
- Done
Gatehering public group(s)
- All-users-of-Android-Alpha-Team-Only
2021/10/14 13:28:05 [DEBUG] GET https://api.appcenter.ms/v0.1/apps/pocket-app/Android-Alpha-Team-Only/distribution_groups/All-users-of-Android-Alpha-Team-Only
{ID:7202aa0e-6f65-441d-9d43-939b3073d322 Name:All-users-of-Android-Alpha-Team-Only DisplayName:All-users-of-Android-Alpha-Team-Only Origin:appcenter IsPublic:true Error:: }
- Done
Setting distribution store(s)
- Done
Setting distribution tester(s)
- Done
Exporting outputs
- APPCENTER_PUBLIC_INSTALL_PAGE_URLS: https://install.appcenter.ms/users/pocket-app/apps/Android-Alpha-Team-Only/distribution_groups/All-users-of-Android-Alpha-Team-Only
- APPCENTER_DEPLOY_STATUS: success
- APPCENTER_DEPLOY_INSTALL_URL: https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/51511bfc-84cd-48ea-9b2f-2b0d96cb2116/Pocket-teamA-teamRelease.apk?sv=2019-02-02&sr=c&sig=AIcOhRv%2BwcQuUhzzOHpWBMsWGZXBD9RC914FnamEqes%3D&se=2021-10-15T13%3A28%3A04Z&sp=r
- APPCENTER_DEPLOY_DOWNLOAD_URL: https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/51511bfc-84cd-48ea-9b2f-2b0d96cb2116/Pocket-teamA-teamRelease.apk?sv=2019-02-02&sr=c&sig=AIcOhRv%2BwcQuUhzzOHpWBMsWGZXBD9RC914FnamEqes%3D&se=2021-10-15T13%3A28%3A04Z&sp=r
- APPCENTER_RELEASE_PAGE_URL: https://appcenter.ms/orgs/pocket-app/apps/Android-Alpha-Team-Only/distribute/releases/1520
- APPCENTER_DEPLOY_RELEASE_ID: 1520
- APPCENTER_PUBLIC_INSTALL_PAGE_URL: https://install.appcenter.ms/users/pocket-app/apps/Android-Alpha-Team-Only/distribution_groups/All-users-of-Android-Alpha-Team-Only
- Done
</pre>
</details>
### Steps to reproduce
1. Install an app distributed with AppCenter Distribute with in-app updates enabled.
2. Push a new version using `appcenter-deploy-android` in a Bitrise build.
3. Open the app. AppCenter prompts that a new update is available.
4. Confirm and wait for the download to finish.
5. Close and reopen the app to trigger installation.
Actual result: update fails with a confusing "Failed to download app update" message.
Expected result: system app update confirmation prompt appears and installation continues successfully after confirming.
Now that the AppStore Connect API is available, you might want to consider using that instead. Then you don’t have to worry with this!
system
Closed
December 5, 2021, 8:14pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.