expo-updates 57.0.18 → 57.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,23 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 57.0.19 — 2026-08-28
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [Android] Register the embedded update in a single transaction. An interrupted registration previously left an update row with no launch asset, which is treated as launchable and then fails every cold start with "Launch asset not found for update"; it now leaves no row, so the next launch registers it cleanly. ([#49130](https://github.com/expo/expo/pull/49130) by [@gwdp](https://github.com/gwdp))
18
+ - [Android] Widen `UpdatesLogEntry.create`'s catch from `JSONException` to `Exception` so log-line parse failures consistently degrade to "skip the entry" instead of propagating. ([#46182](https://github.com/expo/expo/pull/46182) by [@jakequade-pc](https://github.com/jakequade-pc))
19
+ - [Android] Correct `UpdatesLogReader.ONE_DAY_MILLISECONDS` from `86400` (seconds) to `86_400_000` (milliseconds), so the "older than one day" purge filter actually retains a day's worth of entries instead of ~86 seconds' worth. ([#46182](https://github.com/expo/expo/pull/46182) by [@jakequade-pc](https://github.com/jakequade-pc))
20
+ - [iOS] Propagate database failures from `addNewAssets` instead of swallowing them, which let an update be marked ready without its launch asset and then fail every launch. ([#49456](https://github.com/expo/expo/pull/49456) by [@alanjhughes](https://github.com/alanjhughes))
21
+ - [iOS] Repair ready updates that are missing their launch asset by demoting them to pending during launcher selection, so a corrupted row is skipped and retried instead of failing every launch. ([#49457](https://github.com/expo/expo/pull/49457) by [@alanjhughes](https://github.com/alanjhughes))
22
+ - [Android] Skip and repair updates that are missing their launch asset instead of selecting them for launch, which previously failed every cold start with "Launch asset not found for update". ([#49470](https://github.com/expo/expo/pull/49470) by [@alanjhughes](https://github.com/alanjhughes), based on [#48733](https://github.com/expo/expo/pull/48733) by [@martintreurnicht](https://github.com/martintreurnicht))
23
+ - [iOS] Fix the embedded manifest recording the wrong `packagerHash` for assets that ship scale variants iOS does not allow (such as `@1.5x` and `@4x`): the hashes were read by the filtered scale index instead of the asset's own, so those images resolved to an empty URI and rendered blank in release builds. ([#48811](https://github.com/expo/expo/pull/48811) by [@expo-bot](https://github.com/expo-bot))
24
+
25
+ ### 💡 Others
26
+
27
+ - [Android] Replace the "this should never happen" wording in the missing launch asset error with the likely cause and how the state resolves. ([#49130](https://github.com/expo/expo/pull/49130) by [@gwdp](https://github.com/gwdp))
28
+ - [Android] Log purge completion errors via `android.util.Log.e` directly instead of `logger.error`, so the failure path doesn't re-enter the `PersistentFileLog` dispatch queue from inside one of its own tasks. ([#46182](https://github.com/expo/expo/pull/46182) by [@jakequade-pc](https://github.com/jakequade-pc))
29
+
13
30
  ## 57.0.18 — 2026-08-26
14
31
 
15
32
  ### 🐛 Bug fixes
@@ -42,7 +42,7 @@ expoModule {
42
42
  }
43
43
 
44
44
  group = 'host.exp.exponent'
45
- version = '57.0.18'
45
+ version = '57.0.19'
46
46
 
47
47
  // Utility method to derive boolean values from the environment or from Java properties,
48
48
  // and return them as strings to be used in BuildConfig fields
@@ -94,7 +94,7 @@ android {
94
94
  namespace "expo.modules.updates"
95
95
  defaultConfig {
96
96
  versionCode 31
97
- versionName '57.0.18'
97
+ versionName '57.0.19'
98
98
  consumerProguardFiles("proguard-rules.pro")
99
99
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
100
100
 
@@ -4,6 +4,7 @@ import android.app.Activity
4
4
  import android.content.Context
5
5
  import android.net.Uri
6
6
  import android.os.Bundle
7
+ import android.util.Log
7
8
  import com.facebook.react.ReactHost
8
9
  import com.facebook.react.bridge.ReactContext
9
10
  import com.facebook.react.devsupport.interfaces.DevSupportManager
@@ -18,7 +19,6 @@ import expo.modules.updates.events.IUpdatesEventManager
18
19
  import expo.modules.updates.events.UpdatesEventManager
19
20
  import expo.modules.updates.launcher.Launcher.LauncherCallback
20
21
  import expo.modules.updates.loader.FileDownloader
21
- import expo.modules.updates.logging.UpdatesErrorCode
22
22
  import expo.modules.updates.logging.UpdatesLogReader
23
23
  import expo.modules.updates.logging.UpdatesLogger
24
24
  import expo.modules.updates.manifest.EmbeddedManifestUtils
@@ -90,7 +90,12 @@ class EnabledUpdatesController(
90
90
  private fun purgeUpdatesLogsOlderThanOneDay() {
91
91
  UpdatesLogReader(context.filesDir).purgeLogEntries {
92
92
  if (it != null) {
93
- logger.error("UpdatesLogReader: error in purgeLogEntries", it, UpdatesErrorCode.Unknown)
93
+ // Log directly via android.util.Log rather than through `logger.error`,
94
+ // which writes via the PersistentFileLog dispatch queue. This callback
95
+ // is invoked from inside one of that queue's own tasks, so feeding
96
+ // another entry back into the queue from here re-enters it. Bypassing
97
+ // the queue keeps the failure path off its own back.
98
+ Log.e("expo-updates", "UpdatesLogReader: error in purgeLogEntries", it)
94
99
  }
95
100
  }
96
101
  }
@@ -87,7 +87,7 @@ class DatabaseLauncher(
87
87
  // verify that we have all assets on disk
88
88
  // according to the database, we should, but something could have gone wrong on disk
89
89
  val launchAsset = database.updateDao().loadLaunchAssetForUpdate(launchedUpdate!!.id)
90
- ?: throw Exception("Launch asset not found for update; this should never happen. Debug info: ${launchedUpdate!!.debugInfo()}")
90
+ ?: throw Exception("Launch asset not found for update. The update row has no launch asset; an interrupted registration in an older version of expo-updates can leave an update in this state, and it is replaced once a newer update is downloaded. Debug info: ${launchedUpdate!!.debugInfo()}")
91
91
 
92
92
  if (launchAsset.relativePath == null) {
93
93
  throw Exception("Launch asset relative path should not be null. Debug info: ${launchedUpdate!!.debugInfo()}")
@@ -161,6 +161,15 @@ class DatabaseLauncher(
161
161
  if (!configuration.hasEmbeddedUpdate && embeddedUpdate?.updateEntity?.id == update.id) {
162
162
  continue
163
163
  }
164
+
165
+ // An update with no launch asset can never launch. Excluding it here lets the loader
166
+ // re-run and repair the row instead of failing every cold start.
167
+ if (update.status != UpdateStatus.DEVELOPMENT &&
168
+ database.updateDao().loadLaunchAssetForUpdate(update.id) == null
169
+ ) {
170
+ logger.warn("Skipping launchable update with no launch asset. Debug info: ${update.debugInfo()}")
171
+ continue
172
+ }
164
173
  filteredLaunchableUpdates.add(update)
165
174
  }
166
175
  val manifestFilters = ManifestMetadata.getManifestFilters(database, configuration)
@@ -1,6 +1,7 @@
1
1
  package expo.modules.updates.loader
2
2
 
3
3
  import android.content.Context
4
+ import androidx.room.withTransaction
4
5
  import expo.modules.updates.UpdatesConfiguration
5
6
  import expo.modules.updates.UpdatesUtils
6
7
  import expo.modules.updates.db.UpdatesDatabase
@@ -17,6 +18,7 @@ import expo.modules.updates.logging.UpdatesErrorCode
17
18
  import expo.modules.updates.logging.UpdatesLogger
18
19
  import expo.modules.updates.manifest.ManifestMetadata
19
20
  import expo.modules.updates.manifest.Update
21
+ import kotlinx.coroutines.CancellationException
20
22
  import kotlinx.coroutines.CoroutineScope
21
23
  import kotlinx.coroutines.Dispatchers
22
24
  import kotlinx.coroutines.SupervisorJob
@@ -164,21 +166,32 @@ abstract class Loader protected constructor(
164
166
  database.updateDao().setUpdateScopeKey(existingUpdateEntity, newUpdateEntity.scopeKey)
165
167
  }
166
168
 
167
- if (existingUpdateEntity != null && existingUpdateEntity.status == UpdateStatus.READY) {
169
+ // A READY update with no launch asset is not actually ready. Fall through to
170
+ // downloadAllAssets so its assets are re-registered instead of staying broken forever.
171
+ if (existingUpdateEntity != null && existingUpdateEntity.status == UpdateStatus.READY &&
172
+ database.updateDao().loadLaunchAssetForUpdate(existingUpdateEntity.id) != null
173
+ ) {
168
174
  // hooray, we already have this update downloaded and ready to go!
169
175
  updateEntity = existingUpdateEntity
170
176
  return finish()
171
177
  } else {
178
+ val insertUpdateEntityOnFinish: Boolean
172
179
  if (existingUpdateEntity == null) {
173
- // no update already exists with this ID, so we need to insert it and download everything.
180
+ // no update already exists with this ID, so we need to download everything.
174
181
  updateEntity = newUpdateEntity
175
- database.updateDao().insertUpdate(updateEntity!!)
182
+ // EMBEDDED is already in the launchable set, so a row inserted before its launch asset exists
183
+ // gets picked as launchable and then fails every launch.
184
+ insertUpdateEntityOnFinish = newUpdateEntity.status == UpdateStatus.EMBEDDED
185
+ if (!insertUpdateEntityOnFinish) {
186
+ database.updateDao().insertUpdate(updateEntity!!)
187
+ }
176
188
  } else {
177
189
  // we've already partially downloaded the update, so we should use the existing entity.
178
190
  // however, it's not ready, so we should try to download all the assets again.
179
191
  updateEntity = existingUpdateEntity
192
+ insertUpdateEntityOnFinish = false
180
193
  }
181
- return downloadAllAssets(update)
194
+ return downloadAllAssets(update, insertUpdateEntityOnFinish)
182
195
  }
183
196
  }
184
197
 
@@ -188,7 +201,7 @@ abstract class Loader protected constructor(
188
201
  ERRORED
189
202
  }
190
203
 
191
- private suspend fun downloadAllAssets(update: Update): LoaderResult {
204
+ private suspend fun downloadAllAssets(update: Update, insertUpdateEntityOnFinish: Boolean): LoaderResult {
192
205
  val assetList = update.assetEntityList.distinctBy { it.key }
193
206
  assetTotal = assetList.size
194
207
 
@@ -235,26 +248,34 @@ abstract class Loader protected constructor(
235
248
  assetDownloadJobs.awaitAll()
236
249
 
237
250
  try {
238
- for (asset in existingAssetList) {
239
- val existingAssetFound = database.assetDao()
240
- .addExistingAssetToUpdate(updateEntity!!, asset, asset.isLaunchAsset)
241
- if (!existingAssetFound) {
242
- // the database and filesystem have gotten out of sync
243
- // do our best to create a new entry for this file even though it already existed on disk
244
- // TODO: we should probably get rid of this assumption that if an asset exists on disk with the same filename, it's the same asset
245
- var hash: ByteArray? = null
246
- try {
247
- hash = UpdatesUtils.sha256(File(updatesDirectory, asset.relativePath))
248
- } catch (_: Exception) {
251
+ database.withTransaction {
252
+ if (insertUpdateEntityOnFinish) {
253
+ database.updateDao().insertUpdate(updateEntity!!)
254
+ }
255
+
256
+ for (asset in existingAssetList) {
257
+ val existingAssetFound = database.assetDao()
258
+ .addExistingAssetToUpdate(updateEntity!!, asset, asset.isLaunchAsset)
259
+ if (!existingAssetFound) {
260
+ // the database and filesystem have gotten out of sync
261
+ // do our best to create a new entry for this file even though it already existed on disk
262
+ // TODO: we should probably get rid of this assumption that if an asset exists on disk with the same filename, it's the same asset
263
+ var hash: ByteArray? = null
264
+ try {
265
+ hash = UpdatesUtils.sha256(File(updatesDirectory, asset.relativePath))
266
+ } catch (_: Exception) {
267
+ }
268
+ asset.downloadTime = Date()
269
+ asset.hash = hash
270
+ finishedAssetList.add(asset)
249
271
  }
250
- asset.downloadTime = Date()
251
- asset.hash = hash
252
- finishedAssetList.add(asset)
253
272
  }
254
- }
255
273
 
256
- database.assetDao().insertAssets(finishedAssetList, updateEntity!!)
257
- database.updateDao().markUpdateFinished(updateEntity!!)
274
+ database.assetDao().insertAssets(finishedAssetList, updateEntity!!)
275
+ database.updateDao().markUpdateFinished(updateEntity!!)
276
+ }
277
+ } catch (e: CancellationException) {
278
+ throw e
258
279
  } catch (e: Exception) {
259
280
  throw IOException("Error while adding new update to database", e)
260
281
  }
@@ -3,7 +3,6 @@ package expo.modules.updates.logging
3
3
  import expo.modules.jsonutils.getNullable
4
4
  import expo.modules.jsonutils.require
5
5
  import org.json.JSONArray
6
- import org.json.JSONException
7
6
  import org.json.JSONObject
8
7
 
9
8
  /**
@@ -59,7 +58,11 @@ data class UpdatesLogEntry(
59
58
  List(jsonArray.length()) { i -> jsonArray.getString(i) }
60
59
  }
61
60
  )
62
- } catch (e: JSONException) {
61
+ } catch (e: Exception) {
62
+ // `JSONObject.require<T>` can surface a ClassCastException via a blind
63
+ // cast in the catch-all branch (e.g. an int-sized numeric `duration`
64
+ // token surfaces as `Integer`), which would otherwise escape and
65
+ // propagate to the caller.
63
66
  null
64
67
  }
65
68
  }
@@ -54,6 +54,6 @@ class UpdatesLogReader(
54
54
  }
55
55
 
56
56
  companion object {
57
- private const val ONE_DAY_MILLISECONDS = 86400
57
+ private const val ONE_DAY_MILLISECONDS = 86_400_000L
58
58
  }
59
59
  }
@@ -160,7 +160,7 @@ public final class UpdatesDatabase: NSObject {
160
160
  )
161
161
  } catch {
162
162
  sqlite3_exec(db, "ROLLBACK;", nil, nil, nil)
163
- return
163
+ throw error
164
164
  }
165
165
 
166
166
  // statements must stay in precisely this order for last_insert_rowid() to work correctly
@@ -170,7 +170,7 @@ public final class UpdatesDatabase: NSObject {
170
170
  _ = try execute(sql: updateSql, withArgs: [updateId])
171
171
  } catch {
172
172
  sqlite3_exec(db, "ROLLBACK;", nil, nil, nil)
173
- return
173
+ throw error
174
174
  }
175
175
  }
176
176
 
@@ -181,7 +181,7 @@ public final class UpdatesDatabase: NSObject {
181
181
  _ = try execute(sql: updateInsertSql, withArgs: [updateId])
182
182
  } catch {
183
183
  sqlite3_exec(db, "ROLLBACK;", nil, nil, nil)
184
- return
184
+ throw error
185
185
  }
186
186
  }
187
187
 
@@ -444,7 +444,23 @@ public final class UpdatesDatabase: NSObject {
444
444
  )
445
445
 
446
446
  let rows = try execute(sql: sql, withArgs: [config.scopeKey])
447
- return rows.map { row in
447
+
448
+ // A ready row with no launch asset is corrupt (e.g. from an interrupted registration) and
449
+ // would fail every launch. Demote it for the loader to retry instead of offering it.
450
+ var launchableRows: [[String: Any?]] = []
451
+ for row in rows {
452
+ let status: NSNumber = row.requiredValue(forKey: "status")
453
+ let launchAssetId: NSNumber? = row.optionalValue(forKey: "launch_asset_id")
454
+ if status.intValue == UpdateStatus.StatusReady.rawValue && launchAssetId == nil {
455
+ let updateId: UUID = row.requiredValue(forKey: "id")
456
+ let demoteSql = "UPDATE updates SET status = ?1 WHERE id = ?2;"
457
+ _ = try execute(sql: demoteSql, withArgs: [UpdateStatus.StatusPending.rawValue, updateId])
458
+ } else {
459
+ launchableRows.append(row)
460
+ }
461
+ }
462
+
463
+ return launchableRows.map { row in
448
464
  update(withRow: row, config: config)
449
465
  }
450
466
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "57.0.18",
3
+ "version": "57.0.19",
4
4
  "description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -60,10 +60,10 @@
60
60
  "picomatch": "^4.0.4",
61
61
  "ts-node": "^10.9.2",
62
62
  "xstate": "^4.37.2",
63
- "@expo/metro-config": "57.0.11",
64
- "expo": "57.0.17",
65
- "expo-module-scripts": "56.0.3",
66
- "expo-dev-client": "57.0.16"
63
+ "@expo/metro-config": "57.0.12",
64
+ "expo-dev-client": "57.0.16",
65
+ "expo": "57.0.18",
66
+ "expo-module-scripts": "56.0.3"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "expo": "*",
@@ -82,7 +82,7 @@
82
82
  "./scripts/with-node.sh"
83
83
  ]
84
84
  },
85
- "gitHead": "c300d2cc60c9e684e64f48d9bc90ea18a571d01d",
85
+ "gitHead": "c3739f09b6a7620729ce7e305e88a2ec8bc79c3c",
86
86
  "scripts": {
87
87
  "build": "expo-module build",
88
88
  "clean": "expo-module clean",
@@ -64,12 +64,14 @@ export async function createManifestForBuildAsync(
64
64
  'The hashAssetFiles Metro plugin is not configured. You need to add a metro.config.js to your project that configures Metro to use this plugin. See https://github.com/expo/expo/blob/main/packages/expo-updates/README.md#metroconfigjs for an example.'
65
65
  );
66
66
  }
67
- filterPlatformAssetScales(platform, asset.scales).forEach(function (scale, index) {
67
+ filterPlatformAssetScales(platform, asset.scales).forEach(function (scale) {
68
68
  const baseAssetInfoForManifest = {
69
69
  name: asset.name,
70
70
  type: asset.type,
71
71
  scale,
72
- packagerHash: asset.fileHashes[index],
72
+ // `fileHashes` is parallel to the unfiltered `asset.scales`, so it must be indexed by the
73
+ // scale's position there rather than by its position in the filtered list.
74
+ packagerHash: asset.fileHashes[asset.scales.indexOf(scale)],
73
75
  subdirectory: asset.httpServerLocation,
74
76
  };
75
77
  if (platform === 'ios') {