From e0122feb2b528eef031f2918ee5cb23b7a032a5d Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Thu, 20 Aug 2026 00:26:33 +0200 Subject: [PATCH] fix(release): address the Amazon submission API by app id instead of package name The App Submission API stopped resolving apps by package name and now returns 400 "No app found with the entered Inputs"; it requires the amzn1.devportal.mobileapp app id from the console URL. Read the id from AMAZON_APPSTORE_APP_ID, validate it in preflight, and keep the package name for console-facing messages. --- scripts/release/deploy.py | 15 +++++++++++++-- scripts/release/test_deploy.py | 5 ++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/release/deploy.py b/scripts/release/deploy.py index 0f71d5150..c6b45826d 100755 --- a/scripts/release/deploy.py +++ b/scripts/release/deploy.py @@ -41,6 +41,8 @@ Credentials come from .env at the repository root (same file fastlane used): SUPPLY_JSON_KEY_DATA / SUPPLY_JSON_KEY Play service-account JSON (data or path) SUPPLY_PACKAGE_NAME Android package name AMAZON_APPSTORE_CLIENT_ID / _CLIENT_SECRET / _PACKAGE_NAME + AMAZON_APPSTORE_APP_ID Amazon App ID (amzn1.devportal. + mobileapp...., from the console URL) DELIVER_APP_IDENTIFIER Apple bundle id ASC_KEY_ID / ASC_ISSUER_ID / ASC_KEY_PATH App Store Connect team API key @@ -480,6 +482,7 @@ def phase_preflight(ctx: Context) -> None: "AMAZON_APPSTORE_CLIENT_ID", "AMAZON_APPSTORE_CLIENT_SECRET", "AMAZON_APPSTORE_PACKAGE_NAME", + "AMAZON_APPSTORE_APP_ID", ], "amazon", ) @@ -488,6 +491,12 @@ def phase_preflight(ctx: Context) -> None: "amazon: AMAZON_APPSTORE_PACKAGE_NAME must be com.edde746.plezy3; " f"got {env['AMAZON_APPSTORE_PACKAGE_NAME']!r}" ) + if not env["AMAZON_APPSTORE_APP_ID"].startswith("amzn1.devportal.mobileapp."): + raise DeployError( + "amazon: AMAZON_APPSTORE_APP_ID must be the amzn1.devportal.mobileapp. " + "app id from the developer-console URL; the API no longer accepts " + f"package names; got {env['AMAZON_APPSTORE_APP_ID']!r}" + ) if pending & {"ios", "tvos", "asc"}: require_env( env, @@ -957,13 +966,15 @@ def _commit_amazon_edit(ctx: Context, client: AmazonClient, edit_id: str) -> Non def phase_amazon(ctx: Context) -> None: package = ctx.env["AMAZON_APPSTORE_PACKAGE_NAME"] + # The submission API addresses apps by Amazon app id; package names 400. + app_id = ctx.env["AMAZON_APPSTORE_APP_ID"] apk = ROOT / "build/app/outputs/flutter-apk/app-release.apk" if dry_guard(ctx, f"build Amazon APK, replace binary in an edit for {package}, commit"): return pending_edit_id = ctx.state.data.get("amazon_pending_edit_id") if pending_edit_id: log(f"amazon: resuming pending edit {pending_edit_id} without replacing its APK") - client = AmazonClient(package, _amazon_token(ctx.env)) + client = AmazonClient(app_id, _amazon_token(ctx.env)) _commit_amazon_edit(ctx, client, str(pending_edit_id)) return @@ -989,7 +1000,7 @@ def phase_amazon(ctx: Context) -> None: if not apk.is_file(): raise DeployError(f"amazon: APK not found at {apk}") - client = AmazonClient(package, _amazon_token(ctx.env)) + client = AmazonClient(app_id, _amazon_token(ctx.env)) edits_response = client.request("GET", "/edits") edits = edits_response.json() if edits_response.text.strip() else {} diff --git a/scripts/release/test_deploy.py b/scripts/release/test_deploy.py index c7b6707bb..1c87bdb5c 100644 --- a/scripts/release/test_deploy.py +++ b/scripts/release/test_deploy.py @@ -528,7 +528,10 @@ class DeferredPhaseTest(unittest.TestCase): defaults.update(args) return deploy.Context( args=SimpleNamespace(**defaults), - env={"AMAZON_APPSTORE_PACKAGE_NAME": "com.example.app"}, + env={ + "AMAZON_APPSTORE_PACKAGE_NAME": "com.example.app", + "AMAZON_APPSTORE_APP_ID": "amzn1.devportal.mobileapp.fixture", + }, state=state, phases=["amazon", "publish"], )