codemagic-ci-cd / cli-tools

Various utilities to managing Android and iOS app builds, code signing, and deployment.
https://codemagic.io/start/
GNU General Public License v3.0
243 stars 42 forks source link

Sometimes getting the following error when publishing macOS to TestFlight `422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.`` #346

Closed nilsreichardt closed 11 months ago

nilsreichardt commented 11 months ago

Sometimes it works, sometimes we get the following issue:

POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
Failed to publish Sharezone.pkg
Find uploaded build
Type: apps
Bundle id: de.codingbrain.sharezone.app
Name: Sharezone - Schulplaner
Primary locale: de-DE
Sku: de.codingbrain.sharezone.app
Available in new territories: True
Content rights declaration: DOES_NOT_USE_THIRD_PARTY_CONTENT
Is or ever was made for kids: False

-- Build --
Uploaded build is
Id: 57fcc640-c9ab-43dd-8b8c-874d1a34da17
Type: builds
Expired: False
Icon asset token: 
    Template url: https://is1-ssl.mzstatic.com/image/thumb/Purple[116](https://github.com/SharezoneApp/sharezone-app/actions/runs/6184465011/job/16788185713#step:11:117)/v4/3b/3e/b7/3b3eb716-0b97-7c85-4ffe-1dfb2eef89bf/AppIcon-0-0-2x_U007epad-0-0-0-8-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/{w}x{h}bb.{f}
    Height: 167
    Width: 167
Min os version: 12.0

Update beta build localization info in TestFlight for uploaded build
Processing state: VALID
Version: 515
Uses non exempt encryption: False
Uploaded date: 2023-08-31 03:03:09-07:00
Expiration date: 2023-11-29 03:03:09-08:00
Using application Sharezone - Schulplaner primary locale de-DE for beta build localization
Modify Beta Build Localization 1779ac40-4db5-42fc-8b47-7366ff5f73a4
Successfully modified Beta Build Localization 1779ac40-4db5-42fc-8b47-7366ff5f73a4
-- Beta Build Localization --
Id: 1779ac40-4db5-42fc-8b47-7366ff5f73a4
Type: betaBuildLocalizations
Locale: de-DE
Whats new: Upgrade to Flutter v3.13.4 (#952)

Changelog of Flutter v3.13.4:

* dart/53449 - Fixes a dart2js issue causing a compiler crash when using
a typed record pattern outside of the scope of a function body.
* dart/53450 - Fixes a pause in the debugger when reaching an unhandled
exception.
* flutter/[133](https://github.com/SharezoneApp/sharezone-app/actions/runs/6184465011/job/16788185713#step:11:134)658 - Fixes crash when using the --analyze-size argument.
* flutter/133890 - Fixes incorrect autocorrect highlights in text fields
in iOS 17.
* flutter/[134](https://github.com/SharezoneApp/sharezone-app/actions/runs/6184465011/job/16788185713#step:11:135)468 - Fixes an issue where users are not able to input text
for IME language in iOS 17.
* flutter/45742 - Fixes CVE-2023-4863 - Security vulnerability in WebP.

Submit build '57fcc640-c9ab-43dd-8b8c-874d1a34da17' to TestFlight beta review
Creating new Beta App Review Submission: build: 57fcc640-c9ab-43dd-8b8c-874d1a34da17
POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
Failed to publish Sharezone.pkg
priitlatt commented 11 months ago

Hi! Please share what does this show for you:

app-store-connect builds beta-details "57fcc640-c9ab-43dd-8b8c-874d1a34da17"
nilsreichardt commented 11 months ago
$ app-store-connect builds beta-details "57fcc640-c9ab-43dd-8b8c-874d1a34da17"
Get Build Beta Details for Build 57fcc640-c9ab-43dd-8b8c-874d1a34da17
-- Build Beta Detail --
Id: 57fcc640-c9ab-43dd-8b8c-874d1a34da17
Type: buildBetaDetails
Auto notify enabled: True
External build state: IN_BETA_TESTING
Internal build state: IN_BETA_TESTING
priitlatt commented 11 months ago

I presume you manually submitted this build to TestFlight later?

nilsreichardt commented 11 months ago

image

No, looking in App Store Connect the build (build number 515) isn't submitted yet (Ready to submit).

priitlatt commented 11 months ago

No idea what might have caused that. I'll add some additional logging to the step which waits until the build is processed and always output both the build and its beta details info once they are detected as processed and waiting halts. That should shed some more light on what is going on.

I'll let you know once this is ready.

priitlatt commented 11 months ago

@nilsreichardt, please upgrade to version 0.44.1 and let me know when this happens again. Then we should see the exact build processing state, external build state and internal build state after processing was completed right from app-store-connect publish logs, which hopefully reveals why the submission failed.

nilsreichardt commented 11 months ago

Thanks @priitlatt. Here are the logs:

Logs ``` productbuild: Adding component at /Users/runner/work/sharezone-app/sharezone-app/app/build/macos/Build/Products/Release/Sharezone.app productbuild: Wrote product to unsigned.pkg productbuild: Supported OS versions: [Min: 10.14, Before: None] List available code signing certificates in keychain /Users/runner/Library/codemagic-cli-tools/keychains/15-09-23_3j49_uu1.keychain-db productsign: signing product with identity "3rd Party Mac Developer Installer: Sharezone UG (haftungsbeschraenkt) (AJ3PMPVZ7H)" from keychain /Users/runner/Library/codemagic-cli-tools/keychains/15-09-23_3j49_uu1.keychain-db productsign: adding certificate "Apple Worldwide Developer Relations Certification Authority" productsign: adding certificate "Apple Root CA" productsign: Wrote signed product archive to Sharezone.pkg Publish "Sharezone.pkg" to App Store Connect Bundle identifier: de.codingbrain.sharezone.app Install size: 149653KB Version code: 521 Version: 1.7.4 Upload "Sharezone.pkg" to App Store Connect 2023-09-15 09:46:54.785 INFO: [ContentDelivery.Uploader] Received build ID: abc2713e-a2c4-42f4-be4d-ac858beb4920 2023-09-15 09:48:51.739 INFO: [ContentDelivery.Uploader] COMPLETED - PART 1 - asset-description-4C3[55](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:56)AA5-9920-4295-A123-AFCC84420C3C.xml - eTag: "05D7C252608B7EA79FA306BA01E047BF" 2023-09-15 09:49:41.948 INFO: [ContentDelivery.Uploader] Part 1 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.948 INFO: [ContentDelivery.Uploader] Part 2 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.948 INFO: [ContentDelivery.Uploader] Part 3 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.949 INFO: [ContentDelivery.Uploader] Part 4 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.949 INFO: [ContentDelivery.Uploader] Part 5 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.949 INFO: [ContentDelivery.Uploader] Part 6 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.950 INFO: [ContentDelivery.Uploader] Part 7 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.950 INFO: [ContentDelivery.Uploader] Part 8 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.950 INFO: [ContentDelivery.Uploader] Part 9 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.951 INFO: [ContentDelivery.Uploader] Part 10 still needs to be uploaded (5242880 bytes). 2023-09-15 09:49:41.951 INFO: [ContentDelivery.Uploader] Part 11 still needs to be uploaded (254110 bytes). 2023-09-15 09:49:41.951 INFO: [ContentDelivery.Uploader] 11 upload operations were requested for 11 parts. (Build ID = abc2713e-a2c4-42f4-be4d-ac858beb4920) 2023-09-15 09:49:43.062 INFO: [ContentDelivery.Uploader] COMPLETED - PART 1 - Sharezone.pkg - eTag: "AFB98852C245CD8C3BAFF6032A03DDC4" 2023-09-15 09:49:43.491 INFO: [ContentDelivery.Uploader] COMPLETED - PART 5 - Sharezone.pkg - eTag: "F77BB3D31D263FC473158B7AE7109CA7" 2023-09-15 09:49:43.512 INFO: [ContentDelivery.Uploader] COMPLETED - PART 2 - Sharezone.pkg - eTag: "DD0F116CF2EDFF76640DB6C25E35B3F4" 2023-09-15 09:49:43.539 INFO: [ContentDelivery.Uploader] COMPLETED - PART 4 - Sharezone.pkg - eTag: "6091B907BAD1783AB266CA893821F9E3" 2023-09-15 09:49:43.545 INFO: [ContentDelivery.Uploader] COMPLETED - PART 6 - Sharezone.pkg - eTag: "6A1DB9B12A4B2C97435D464604280A68" 2023-09-15 09:49:43.857 INFO: [ContentDelivery.Uploader] COMPLETED - PART 3 - Sharezone.pkg - eTag: "F188AD71FB109EF[56](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:57)A5F92AD[57](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:58)D3EDA7" 2023-09-15 09:49:43.863 INFO: [ContentDelivery.Uploader] COMPLETED - PART 7 - Sharezone.pkg - eTag: "3CE4749B3DE621B42F3DFECE9E0FAA43" 2023-09-15 09:49:44.509 INFO: [ContentDelivery.Uploader] COMPLETED - PART 10 - Sharezone.pkg - eTag: "8ABDA6BAF66C986418090B5DE082B827" 2023-09-15 09:49:44.724 INFO: [ContentDelivery.Uploader] COMPLETED - PART 8 - Sharezone.pkg - eTag: "6919089BF3B4884F521C347EF5BC215D" No errors uploading "Sharezone.pkg". Find application entry from App Store Connect for uploaded binary 2023-09-15 09:49:44.836 INFO: [ContentDelivery.Uploader] COMPLETED - PART 9 - Sharezone.pkg - eTag: "CEF43A8F2C81B59186BD84FAA1ACA5EC" 2023-09-15 09:49:45.311 INFO: [ContentDelivery.Uploader] COMPLETED - PART 11 - Sharezone.pkg - eTag: "431FE9ED8ABFED0A0B2A74FAAD90A92D" 2023-09-15 09:49:45.314 INFO: [ContentDelivery.Uploader] Time to transfer: 1.627 seconds (32374.70KB/s) 2023-09-15 09:49:46.600 INFO: [ContentDelivery.Uploader] ================ UPLOAD SUCCEEDED Delivery UUID: abc2713e-a2c4-42f4-be4d-ac8[58](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:59)beb4920 Transferred 52682910 bytes in 1.627 seconds (32.4MB/s) ================ {"tool-version":"6.315.14315","tool-path":"\/Applications\/Xcode_14.3.1.app\/Contents\/SharedFrameworks\/ContentDeliveryServices.framework\/Versions\/A\/Frameworks\/AppStoreService.framework","success-message":"No errors uploading 'Sharezone.pkg'","os-version":"13.5.1"} Found 1 App matching specified filters: bundleId=de.codingbrain.sharezone.app. -- App -- Id: 1434868489 Type: apps Find uploaded build Bundle id: de.codingbrain.sharezone.app Name: Sharezone - Schulplaner Primary locale: de-DE Sku: de.codingbrain.sharezone.app Available in new territories: True Content rights declaration: DOES_NOT_USE_THIRD_PARTY_CONTENT Is or ever was made for kids: False -- Build -- Uploaded build is Id: 2[60](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:61)67aac-6df8-4[65](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:66)d-afcd-fda48f81abab Type: builds Expired: False Icon asset token: Update beta build localization info in TestFlight for uploaded build Template url: https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/1b/40/5f/1b405fdb-f9e0-b122-6f1a-196051372e8e/AppIcon-0-0-2x_U007epad-0-0-0-8-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/{w}x{h}bb.{f} Height: 1[67](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:68) Width: 167 Min os version: 12.0 Processing state: VALID Version: 521 Uses non exempt encryption: False Uploaded date: 2023-09-02 07:10:28-07:00 Expiration date: 2023-12-01 07:10:28-08:00 Using application Sharezone - Schulplaner primary locale de-DE for beta build localization Modify Beta Build Localization eca8750d-3290-4db7-b4a5-111af2eb6e3f Successfully modified Beta Build Localization eca8750d-3290-4db7-b4a5-111af2eb6e3f -- Beta Build Localization -- Wait until build 26067aac-6df8-465d-afcd-fda48f81abab and its beta details are processed Id: eca8750d-3290-4db7-b4a5-111af2eb6e3f Type: betaBuildLocalizations Locale: de-DE Whats new: Upgrade Codemagic CLI tools to `0.44.1` (#9[69](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:70)) Required to get more information about this issue: https://github.com/codemagic-ci-cd/cli-tools/issues/346#issuecomment-1[72](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:73)084[75](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:76)[78](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:79) Processing build 26067aac-6df8-465d-afcd-fda48f[81](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:82)abab is completed Processing build 26067aac-6df8-465d-afcd-fda48f81abab beta detail 26067aac-6df8-465d-afcd-fda48f81abab is completed Processed build and beta details are -- Build -- Id: 26067aac-6df8-465d-afcd-fda48f81abab Type: builds Expired: False Icon asset token: Template url: https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/1b/40/5f/1b405fdb-f9e0-b122-6f1a-196051372e8e/AppIcon-0-0-2x_U007epad-0-0-0-8-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-[85](https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351#step:11:86)-220-0-0.png/{w}x{h}bb.{f} Height: 167 Width: 167 Min os version: 12.0 Processing state: VALID Version: 521 Uses non exempt encryption: False Uploaded date: 2023-09-02 07:10:28-07:00 Expiration date: 2023-12-01 07:10:28-08:00 -- Build Beta Detail -- Submit build '26067aac-6df8-465d-afcd-fda48f81abab' to TestFlight beta review Id: 26067aac-6df8-465d-afcd-fda48f81abab Type: buildBetaDetails Auto notify enabled: True External build state: IN_BETA_TESTING Internal build state: IN_BETA_TESTING Creating new Beta App Review Submission: build: 26067aac-6df8-465d-afcd-fda48f81abab POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation. Failed to publish Sharezone.pkg ```

https://github.com/SharezoneApp/sharezone-app/actions/runs/6196403244/job/16822974351

priitlatt commented 11 months ago

How often does this issue occur? All the statuses seem correct, which makes me think whether it is some glitch on Apple's side of things.

nilsreichardt commented 11 months ago
Workflow ID  Deployment Status Error Message
386  ✅
385  ✅
 384  ✅
383  ✅
382  ❌ GET https://api.appstoreconnect.apple.com/v1/builds/e7ee7e4e-3494-4757-970b-73be6a74c0a9/buildBetaDetail returned 404: The specified resource does not exist - There is no resource of type 'buildBetaDetails' with id 'e7ee7e4e-3494-4757-970b-73be6a74c0a9'
 381  ❌  POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
379  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
378  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
377  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
376  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
375  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
374  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
373  ✅
372  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
371  ✅
370  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
369  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
368  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
367  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
366  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
365  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
364  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
363  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
362  ❌ POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
nilsreichardt commented 11 months ago

Here is the code we use to deploy the macOS app:

app-store-connect publish \
    --path $PACKAGE_NAME \
    --beta-group=alpha \
    --testflight \
    --release-type=AFTER_APPROVAL \
    --whats-new "$SHORT_LAST_COMMIT_MESSAGE"

https://github.com/SharezoneApp/sharezone-app/blob/64874ad2a4fff8c2ae137eab7d2d7ffbe0e1b2aa/.github/workflows/alpha.yml#L405-L410

priitlatt commented 11 months ago

This was quite a mouthful, but I think it finally boils down to the fact that just plain wrong build is looked up after initial upload (for example here, and then consequently operations on this wrong build fail.

priitlatt commented 11 months ago

@nilsreichardt Fix is now available in version 0.45.1.

nilsreichardt commented 11 months ago

Awesome, thanks for the great work! I created a PR to use the new version 👍