bug: status keeps in pending state.
HarryF514 opened this issue Β· comments
Bug Report
Capacitor Version
Latest Dependencies:
@capacitor/cli: 5.0.4
@capacitor/core: 5.0.4
@capacitor/android: 5.0.4
@capacitor/ios: 5.0.4
Installed Dependencies:
@capacitor/cli: 4.6.2
@capacitor/core: 4.6.2
@capacitor/android: 4.6.2
@capacitor/ios: 4.6.2
[success] iOS looking great! π
[success] Android looking great! π
Plugin Version
π Capgo Doctor π
OS: Darwin Kernel Version 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000
Installed Dependencies:
@capgo/cli: 3.10.20
@capgo/capacitor-updater: 4.35.0
β Latest Dependencies:
@capgo/cli: 3.10.20
@capgo/capacitor-updater: 9.0.0
Platform(s)
Android
Current Behavior
I am getting this
downloaded: "2023-05-28T09:18:50.372+0000"
id: "yYNs0ud2pa"
status: "pending"
version: "1.0.0"
then I am getting this:
Error: Set next id failed. Bundle yYNs0ud2pa does not exist.
Expected Behavior
the app should be updated.
Code Reproduction
if ((info && info.platform === 'android') || info.platform === 'ios') {
CapacitorUpdater.notifyAppReady();
CapacitorApp.addListener('appStateChange', async ({ isActive }) => {
if (isActive === true) {
getFlyersCount();
try {
const response =
await apiService.get('latest');
console.log(`CapacitorUpdater response`, response);
const result = await response.json();
console.log(`CapacitorUpdater result`, result);
const versionNumber = result.version;
console.log(`CapacitorUpdater versionNumber`, versionNumber);
// Do the download during user active app time to prevent failed download
const updateResult = await CapacitorUpdater.download({
version: '1.0.0',
url: `https://<s3-url>/1.0.0/Archive.zip`,
});
console.log(`CapacitorUpdater updateResult 1`, updateResult);
capDataUpdate.current = updateResult;
CapacitorUpdater.next({
id: updateResult.id,
});
console.log(`CapacitorUpdater updateResult 2`, updateResult);
} catch (error) {
console.log('CapacitorUpdater download issue', error);
}
}
if (!isActive) {
console.log(`not isActive`);
if (capDataUpdate?.current?.id) {
// Do the switch when user leave app
SplashScreen.show();
try {
const CapacitorUpdaterSetResult = await CapacitorUpdater.set({
id: capDataUpdate?.current.id,
});
console.log(
`CapacitorUpdaterSetResult`,
CapacitorUpdaterSetResult,
);
} catch (err) {
console.log(err);
SplashScreen.hide(); // in case the set fail, otherwise the new app will have to hide it
}
}
}
});
}
Hi,
I had the same problem. What turned out to be the issue, ist that I had encryption enabled. When turning off encryption (i.e. deleting the private key from the capacitor.config.js, and deleting the public key files in the repository) the problem was gone.
I guess you have to provide the private key when calling the download method. The documentation on this isnt great, as is the error management.
I just noticed, that the download actually failed (without the plugin telling you, and that there was a "source file not found" exception in logcat. From there I assumed the encryption was the problem.
Im guessing the private key has to be given as the sessionKey (see here)
Hope that helps
Thanks @b-huessner for the answer, I think you are right the error messages are not clear, I will take a look into that
Here is my capacitor.config.json
I am not seeing any private key in the configuration.
{
"appId": "ca.xxxx.mobile",
"appName": "xxxxx",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "build",
"cordova": {},
"plugins": {
"CapacitorUpdater": {
"autoUpdate": false
},
"FirebaseAuthentication": {
"skipNativeAuth": false,
"providers": ["apple.com", "google.com", "phone"]
},
"SplashScreen": {
"launchAutoHide": false
}
}
}
Okay, then this might be a different error.
What helped me figure out that it was the encryption, was looking at the Exceptions in logcat (at least for Android).
Maybe this can help you figure out what is going wrong
I have the same error.
- My code setup is very similar and a very simple new app without much other code
- I host the update myself (publicly accessible without any private key or authentication)
- My download also stays on "pending" (even triggering the
downloadComplete
Event) - I get the similar error
'Update failed, id dgz2O0FEDa does not exist.'
I wasn't sure if I should open a new issue or, if this belongs here.
Any ideas or new info regarding this issue? Should I open a separate issue?
I solved my problem by trying Github as an update source. With my own server it didn't work, but with Github it did. Although my own server returns a normal "BinaryFileResponse".
Since this has to work through my own server, I'm going to keep experimenting here. If I have any new findings, I will comment here again.