Cap-go / capgo

Instant update for capacitor apps
https://capgo.app
GNU Affero General Public License v3.0
103 stars 54 forks source link

Download stuck at 0 on Android 14 #804

Closed abdullahgira closed 2 weeks ago

abdullahgira commented 3 weeks ago

This situation occurs only on Android 14. This is the capacitor.config.json

{
  "appId": "m2.linq",
  "appName": "M2",
  "plugins": {
    "CapacitorUpdater": {
      "autoUpdate": true
    }
  },
  "webDir": "www"
}

This is the Android Logcat

appId: m2.linq
init for device 04521d60-9ee9-4d95-8602-ad4a8dea1105
version native 4.8.0
onActivityStarted m2.linq.MainActivity
Check for update via: https://api.capgo.app/updates
Auto-update parameters: {"platform":"android","device_id":"04521d60-9ee9-4d95-8602-ad4a8dea1105","app_id":"m2.linq","custom_id":"","version_build":"4.8.0","version_code":"10","version_os":"14","version_name":"builtin","plugin_version":"5.9.5","is_emulator":false,"is_prod":true,"defaultChannel":""}
Wait for 10000ms, then check for notifyAppReady
Stats send for "app_moved_to_foreground", version builtin
Setting status for bundle [builtin] to success
Not saving info for bundle: [builtin] {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
Fallback bundle is: {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
Version successfully loaded: builtin
Current bundle loaded successfully. ['notifyAppReady()' was called] {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
semaphoreReady countDown
semaphoreDown
semaphoreDown count 0
semaphoreReady countDown done
list File : /data/user/0/m2.linq/files/versions
No versions available to list/data/user/0/m2.linq/files/versions
New bundle: 4.8.1 found. Current is: builtin. Update will occur next time app moves to background.
Storing info for bundle [gWrirP29oX] {"id":"gWrirP29oX","version":"4.8.1","downloaded":"2024-08-20T17:56:59.716+0000","checksum":"","status":"downloading"}
Stats send for "download_0", version 4.8.1
Built-in bundle is active. Nothing to do.
Checking for pending update
Stats send for "app_moved_to_background", version builtin
Auto update is disabled
sendReadyToJs
onActivityStarted m2.linq.MainActivity
semaphoreReady sendReadyToJs
Wait for 10000ms, then check for notifyAppReady
semaphoreWait 10000
semaphoreReady count -2147483647
semaphoreReady sendReadyToJs done
Stats send for "app_moved_to_foreground", version builtin
Built-in bundle is active. Nothing to do.
Checking for pending update
Stats send for "app_moved_to_background", version builtin

And this is what the npx @capgo/cli@latest app debug has logged to the console

┌  Debug Live update in Capgo
│
●  Use global apy key /Users/xaydenrosairo/.capgo
│
●  Getting active bundle in Capgo
│
◇  Automatic check if update working in device ?
│  Yes
│
●  Wait logs sent to Capgo from m2.linq device, Please open your app 💪
│
◑  Waiting for logs (Expect delay of 30 sec).│
●  Log from Device: 04521d60-9ee9-4d95-8602-ad4a8dea1105
│
●  Your bundle is downloading 0% ...
│
●  Log from Device: 04521d60-9ee9-4d95-8602-ad4a8dea1105
│
●  Update Sent your your device, wait until event download complete
◑  Waiting for logs (Expect delay of 30 sec)..│
●  Log from Device: 04521d60-9ee9-4d95-8602-ad4a8dea1105
│
■  Log from Capgo app_moved_to_foreground
◒  Waiting for logs (Expect delay of 30 sec)│
●  Log from Device: 04521d60-9ee9-4d95-8602-ad4a8dea1105
│
■  Log from Capgo app_moved_to_background
│
●  Log from Device: 04521d60-9ee9-4d95-8602-ad4a8dea1105
│
●  Your bundle is downloading 0% ...
│
●  Log from Device: 04521d60-9ee9-4d95-8602-ad4a8dea1105
│
●  Update Sent your your device, wait until event download complete
◒  Waiting for logs (Expect delay of 30 sec)│
riderx commented 3 weeks ago

What version of the plugin do you use ?

abdullahgira commented 3 weeks ago

5.9.5

riderx commented 3 weeks ago

Ok so please update to capacitor 6 as this is the only one supporting android 14 https://capacitorjs.com/docs/updating/6-0

abdullahgira commented 3 weeks ago

After doing so I was able to get the update on my Android 14 device, but on iOS 17.5, throws the error Capacitor-updater: Error downloading file Signature was required but none was provided

riderx commented 3 weeks ago

What version of the plugin do you use ?

abdullahgira commented 3 weeks ago

It is 6.1.4

riderx commented 3 weeks ago

It seems this is a bug, i have push a fix in 6.1.11

abdullahgira commented 2 weeks ago

Things were working until I pushed it to the App Store and Play Store, iOS works, but not Android, running the production version locally to get the logs, here is what it says:

2024-08-27 19:51:49.984 16677-16677 Capacitor-updater          I  init for device bc8cfea4-72cc-479c-947e-89690cc26520
2024-08-27 19:51:49.984 16677-16677 Capacitor-updater          I  version native 4.8.3
2024-08-27 19:51:50.075 16677-16677 Capacitor-updater          I  onActivityStarted m2.linq.MainActivity
2024-08-27 19:51:50.076 16677-16896 Capacitor-updater          I  Check for update via: https://api.capgo.app/updates
2024-08-27 19:51:50.076 16677-16896 Capacitor-updater          I  Auto-update parameters: {"platform":"android","device_id":"bc8cfea4-72cc-479c-947e-89690cc26520","app_id":"m2.linq","custom_id":"","version_build":"4.8.3","version_code":"10","version_os":"14","version_name":"builtin","plugin_version":"6.1.12","is_emulator":false,"is_prod":true,"defaultChannel":""}
2024-08-27 19:51:50.079 16677-16897 Capacitor-updater          I  Wait for 10000ms, then check for notifyAppReady
2024-08-27 19:51:50.734 16677-16677 Capacitor-updater          E  Error get latest: {"error":"response_error","message":"Error get latest: Bad Gateway"}
2024-08-27 19:51:50.734 16677-16677 Capacitor-updater          I  API message: Error get latest: Bad Gateway
2024-08-27 19:51:50.734 16677-16677 Capacitor-updater          I  endBackGroundTaskWithNotif errortrue
2024-08-27 19:51:50.735 16677-16677 Capacitor-updater          I  sendReadyToJs
2024-08-27 19:51:50.735 16677-16677 Capacitor-updater          I  endBackGroundTaskWithNotif Error get latest: Bad Gateway
2024-08-27 19:51:50.737 16677-16966 Capacitor-updater          I  semaphoreReady sendReadyToJs
2024-08-27 19:51:50.737 16677-16966 Capacitor-updater          I  semaphoreWait 10000
2024-08-27 19:51:50.961 16677-16677 Capacitor-updater          I  Stats send for "app_moved_to_foreground", version builtin
2024-08-27 19:51:51.183 16677-16872 Capacitor-updater          D  Setting status for bundle [builtin] to success
2024-08-27 19:51:51.183 16677-16872 Capacitor-updater          D  Not saving info for bundle: [builtin] {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-27 19:51:51.183 16677-16872 Capacitor-updater          D  Fallback bundle is: {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-27 19:51:51.183 16677-16872 Capacitor-updater          I  Version successfully loaded: builtin
2024-08-27 19:51:51.188 16677-16872 Capacitor-updater          I  Current bundle loaded successfully. ['notifyAppReady()' was called] {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-27 19:51:51.188 16677-16872 Capacitor-updater          I  semaphoreReady countDown
2024-08-27 19:51:51.188 16677-16872 Capacitor-updater          I  semaphoreDown
2024-08-27 19:51:51.188 16677-16872 Capacitor-updater          I  semaphoreDown count 0
2024-08-27 19:51:51.189 16677-16872 Capacitor-updater          I  semaphoreReady countDown done
2024-08-27 19:51:51.189 16677-16966 Capacitor-updater          I  semaphoreReady count -2147483647
2024-08-27 19:51:51.189 16677-16966 Capacitor-updater          I  semaphoreReady sendReadyToJs done
2024-08-27 19:51:51.521 16677-16677 Capacitor-updater          I  Stats send for "download_fail", version builtin
2024-08-27 19:52:00.079 16677-16897 Capacitor-updater          I  Built-in bundle is active. We skip the check for notifyAppReady.

The plugin version I'm using is 6.1.11.

riderx commented 2 weeks ago

This seems to be a network issue. Can you try to access https://api.capgo.app/updates from the device browser?

riderx commented 2 weeks ago

or use VPN?

abdullahgira commented 2 weeks ago

I can access the URL on Android. Do I need a VPN when the iPhone on the same network can do the update?

abdullahgira commented 2 weeks ago

It is working now, I didn't do anything, these are the logs

2024-08-29 19:35:28.635 24563-24563 Capacitor-updater           I  appId: m2.linq
2024-08-29 19:35:28.642 24563-24563 Capacitor-updater           I  init for device f758c138-3edc-4669-a065-c264d75139a7
2024-08-29 19:35:28.642 24563-24563 Capacitor-updater           I  version native 4.8.3
2024-08-29 19:35:28.753 24563-24563 Capacitor-updater           I  onActivityStarted m2.linq.MainActivity
2024-08-29 19:35:28.763 24563-24792 Capacitor-updater           I  Check for update via: https://api.capgo.app/updates
2024-08-29 19:35:28.764 24563-24792 Capacitor-updater           I  Auto-update parameters: {"platform":"android","device_id":"f758c138-3edc-4669-a065-c264d75139a7","app_id":"m2.linq","custom_id":"","version_build":"4.8.3","version_code":"10","version_os":"14","version_name":"builtin","plugin_version":"6.1.12","is_emulator":false,"is_prod":true,"defaultChannel":""}
2024-08-29 19:35:28.764 24563-24793 Capacitor-updater           I  Wait for 10000ms, then check for notifyAppReady
2024-08-29 19:35:29.919 24563-24563 Capacitor-updater           I  Stats send for "app_moved_to_foreground", version builtin
2024-08-29 19:35:30.070 24563-24755 Capacitor-updater           D  Setting status for bundle [builtin] to success
2024-08-29 19:35:30.070 24563-24755 Capacitor-updater           D  Not saving info for bundle: [builtin] {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-29 19:35:30.071 24563-24755 Capacitor-updater           D  Fallback bundle is: {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-29 19:35:30.071 24563-24755 Capacitor-updater           I  Version successfully loaded: builtin
2024-08-29 19:35:30.076 24563-24755 Capacitor-updater           I  Current bundle loaded successfully. ['notifyAppReady()' was called] {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-29 19:35:30.076 24563-24755 Capacitor-updater           I  semaphoreReady countDown
2024-08-29 19:35:30.076 24563-24755 Capacitor-updater           I  semaphoreDown
2024-08-29 19:35:30.076 24563-24755 Capacitor-updater           I  semaphoreDown count 0
2024-08-29 19:35:30.077 24563-24755 Capacitor-updater           I  semaphoreReady countDown done
2024-08-29 19:35:30.263 24563-24563 Capacitor-updater           D  list File : /data/user/0/m2.linq/files/versions
2024-08-29 19:35:30.263 24563-24563 Capacitor-updater           I  No versions available to list/data/user/0/m2.linq/files/versions
2024-08-29 19:35:30.264 24563-24940 Capacitor-updater           I  New bundle: 4.8.4 found. Current is: builtin. Update will occur next time app moves to background.
2024-08-29 19:35:30.273 24563-24940 Capacitor-updater           D  Storing info for bundle [uG1jf1Wm7I] {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:30.269+0000","checksum":"","status":"downloading"}
2024-08-29 19:35:30.625 24563-24563 Capacitor-updater           I  Stats send for "download_0", version 4.8.4
2024-08-29 19:35:31.414 24563-24563 Capacitor-updater           I  Stats send for "download_10", version 4.8.4
2024-08-29 19:35:31.770 24563-24563 Capacitor-updater           I  Stats send for "download_20", version 4.8.4
2024-08-29 19:35:31.902 24563-24563 Capacitor-updater           I  res uG1jf1Wm7I eYY7JHfnRM 4.8.4  50435c96  
2024-08-29 19:35:31.902 24563-24563 Capacitor-updater           I  Signing not configured
2024-08-29 19:35:31.902 24563-24563 Capacitor-updater           I  Valid signature
2024-08-29 19:35:31.902 24563-24563 Capacitor-updater           I  Cannot found privateKey or sessionKey
2024-08-29 19:35:32.080 24563-24563 Capacitor-updater           D  Removing info for bundle [uG1jf1Wm7I]
2024-08-29 19:35:32.089 24563-24563 Capacitor-updater           D  Storing info for bundle [uG1jf1Wm7I] {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:32.089+0000","checksum":"50435c96","status":"pending"}
2024-08-29 19:35:32.091 24563-24563 Capacitor-updater           D  Setting status for bundle [uG1jf1Wm7I] to pending
2024-08-29 19:35:32.091 24563-24563 Capacitor-updater           D  Storing info for bundle [uG1jf1Wm7I] {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:32.089+0000","checksum":"50435c96","status":"pending"}
2024-08-29 19:35:32.095 24563-24563 Capacitor-updater           I  Stats send for "download_30", version 4.8.4
2024-08-29 19:35:32.196 24563-24563 Capacitor-updater           I  Stats send for "download_40", version 4.8.4
2024-08-29 19:35:32.439 24563-24563 Capacitor-updater           I  Stats send for "download_50", version 4.8.4
2024-08-29 19:35:32.642 24563-24563 Capacitor-updater           I  Stats send for "download_60", version 4.8.4
2024-08-29 19:35:32.895 24563-24563 Capacitor-updater           I  Stats send for "download_70", version 4.8.4
2024-08-29 19:35:33.116 24563-24563 Capacitor-updater           I  Stats send for "download_80", version 4.8.4
2024-08-29 19:35:33.315 24563-24563 Capacitor-updater           I  Stats send for "download_complete", version 4.8.4
2024-08-29 19:35:38.765 24563-24793 Capacitor-updater           I  Built-in bundle is active. We skip the check for notifyAppReady.
2024-08-29 19:36:21.895 24563-24563 Capacitor-updater           I  Checking for pending update
2024-08-29 19:36:21.931 24563-24563 Capacitor-updater           D  Next bundle is: 4.8.4
2024-08-29 19:36:21.931 24563-24563 Capacitor-updater           I  Setting next active bundle: uG1jf1Wm7I
2024-08-29 19:36:21.932 24563-24563 Capacitor-updater           I  Current bundle set to: /data/user/0/m2.linq/files/versions/uG1jf1Wm7I
2024-08-29 19:36:21.949 24563-24563 Capacitor-updater           D  Setting status for bundle [uG1jf1Wm7I] to pending
2024-08-29 19:36:21.949 24563-24563 Capacitor-updater           D  Storing info for bundle [uG1jf1Wm7I] {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:32.089+0000","checksum":"50435c96","status":"pending"}
2024-08-29 19:36:21.951 24563-24563 Capacitor-updater           I  semaphoreUp
2024-08-29 19:36:21.952 24563-24563 Capacitor-updater           I  Reloading: /data/user/0/m2.linq/files/versions/uG1jf1Wm7I
2024-08-29 19:36:21.953 24563-24563 Capacitor-updater           I  Updated to bundle: 4.8.4
2024-08-29 19:36:21.954 24563-26124 Capacitor-updater           I  Wait for 10000ms, then check for notifyAppReady
2024-08-29 19:36:22.195 24563-24563 Capacitor-updater           I  Stats send for "app_moved_to_background", version builtin
2024-08-29 19:36:22.490 24563-24563 Capacitor-updater           I  Stats send for "set", version 4.8.4
2024-08-29 19:36:22.896 24563-24755 Capacitor-updater           D  Setting status for bundle [uG1jf1Wm7I] to success
2024-08-29 19:36:22.896 24563-24755 Capacitor-updater           D  Storing info for bundle [uG1jf1Wm7I] {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:32.089+0000","checksum":"50435c96","status":"success"}
2024-08-29 19:36:22.901 24563-24755 Capacitor-updater           D  Fallback bundle is: {"id":"builtin","version":"builtin","downloaded":"1970-01-01T00:00:00.000Z","checksum":"","status":"success"}
2024-08-29 19:36:22.901 24563-24755 Capacitor-updater           I  Version successfully loaded: 4.8.4
2024-08-29 19:36:22.903 24563-24755 Capacitor-updater           I  Current bundle loaded successfully. ['notifyAppReady()' was called] {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:32.089+0000","checksum":"50435c96","status":"pending"}
2024-08-29 19:36:22.903 24563-24755 Capacitor-updater           I  semaphoreReady countDown
2024-08-29 19:36:22.903 24563-24755 Capacitor-updater           I  semaphoreDown
2024-08-29 19:36:22.903 24563-24755 Capacitor-updater           I  semaphoreDown count -2147483647
2024-08-29 19:36:22.904 24563-24755 Capacitor-updater           I  semaphoreReady countDown done
2024-08-29 19:36:29.190 24563-24563 Capacitor-updater           I  onActivityStarted m2.linq.MainActivity
2024-08-29 19:36:29.192 24563-26124 Capacitor-updater           I  ee.forgr.capacitor_updater.CapacitorUpdaterPlugin$DeferredNotifyAppReadyCheck was interrupted.
2024-08-29 19:36:29.199 24563-26353 Capacitor-updater           I  Wait for 10000ms, then check for notifyAppReady
2024-08-29 19:36:29.199 24563-26352 Capacitor-updater           I  Check for update via: https://api.capgo.app/updates
2024-08-29 19:36:29.200 24563-26352 Capacitor-updater           I  Auto-update parameters: {"platform":"android","device_id":"f758c138-3edc-4669-a065-c264d75139a7","app_id":"m2.linq","custom_id":"","version_build":"4.8.3","version_code":"10","version_os":"14","version_name":"4.8.4","plugin_version":"6.1.12","is_emulator":false,"is_prod":true,"defaultChannel":""}
2024-08-29 19:36:29.459 24563-24563 Capacitor-updater           I  Stats send for "app_moved_to_foreground", version 4.8.4
2024-08-29 19:36:29.930 24563-24563 Capacitor-updater           I  API message: No new version available
2024-08-29 19:36:29.930 24563-24563 Capacitor-updater           I  endBackGroundTaskWithNotif errortrue
2024-08-29 19:36:29.933 24563-24563 Capacitor-updater           I  sendReadyToJs
2024-08-29 19:36:29.934 24563-24563 Capacitor-updater           I  endBackGroundTaskWithNotif No new version available
2024-08-29 19:36:29.935 24563-26355 Capacitor-updater           I  semaphoreReady sendReadyToJs
2024-08-29 19:36:29.935 24563-26355 Capacitor-updater           I  semaphoreWait 10000
2024-08-29 19:36:29.936 24563-26355 Capacitor-updater           I  semaphoreReady count -2147483647
2024-08-29 19:36:29.936 24563-26355 Capacitor-updater           I  semaphoreReady sendReadyToJs done
2024-08-29 19:36:30.455 24563-24563 Capacitor-updater           I  Stats send for "download_fail", version 4.8.4
2024-08-29 19:36:39.201 24563-26353 Capacitor-updater           D  Current bundle is: {"id":"uG1jf1Wm7I","version":"4.8.4","downloaded":"2024-08-29T17:35:32.089+0000","checksum":"50435c96","status":"success"}
2024-08-29 19:36:39.201 24563-26353 Capacitor-updater           I  notifyAppReady was called. This is fine: uG1jf1Wm7I

What do you think was the issue?

riderx commented 2 weeks ago

We found the issue, it seems Cloudflare workers have issue with smart placement lately and made random 520 errors. I apologize for this, we disabled the feature and that resolved the issue. https://discord.com/channels/595317990191398933/779390076219686943/1278109735442317374