react-native-code-push
react-native-code-push copied to clipboard
404 error when trying to download recent updates
Steps to Reproduce
- Publish an update
- Trigger a sync in the next 30 seconds
- Observe the 404 error
Expected Behavior
It is expected that we are not going to encounter a 404 error when the sync
method gets the update.
Actual Behavior
What actually happens?
I think the issues is that the download url is available but not the content. So without having too much info about what is happening in the background I can only assume that it takes some that for the update to be available although it was 'advertised' as available.
2023-05-25 16:06:04.065306+0200 Airbnb[99456:9149076] [javascript] [CodePush] Downloading package.
2023-05-25 16:06:04.560066+0200 Airbnb[99456:9149076] [javascript] [CodePush] An unknown error occurred.
2023-05-25 16:06:04.560368+0200 Airbnb[99456:9149076] [javascript] [CodePush] Received 404 response from https://codepush-secondary.blob.core.windows.net/storagev2/...
The lowest we could go without an error was to try an sync 1 minute and 23 seconds
after the update was pushed. This way we didn't get the 404 error. But I don't think that is not consistent.
Environment
- react-native-code-push version: 8.0.1
- react-native version: 0.64.4
- iOS/Android/Windows version: 16.4
- Does this reproduce on a debug build or release build? staging and release
- Does this reproduce on a simulator, or only on a physical device? both simulator and physical device
Similar #2014
Update: The lowest we could go is 31 seconds
. If we try to sync faster than 31 seconds we are going to get the 404 error mentioned above.
It's happening to us too and it's making it quite tricky to fix critical bugs
Also seeing this!
It's happening to us too and it's making it quite tricky to fix critical bugs
Same for us. At the moment we are forced in using "expo-updates" because we are afraid that a lot of our active users will interact with the app in those first 31 seconds after pushing the update.
it's happening to our apps too. for some reason the user which get this issue will never get the update, until we have pushed the new update. to deal with it, after push the update, we disable the update on appcenter dashboard (user don't get the update), wait 5 minutes, enable it again. when user sync it, they don't get 404 error.
same issue.
It might be ok, except after this happens, the user can't download the version again. The system thinks the client has it already, and never tries to re-download it.
Is there at least a way to mark it as failed so it retries the download on next try?
In case anyone is wondering, the issue isn't triggered by calling localPackage.install
, as I make sure that's not called if the remotePackage
isn't downloaded:
const attemptUpdate = async () => {
try {
await codePush.notifyAppReady()
const remotePackage = await codePush.checkForUpdate()
if (!remotePackage || !removePackage.mandatory) return
const localPackage = await remotePackage.download(onProgress)
if (!window.updateDownloadPercent) {
throw new Error('codePush package not ready yet (404)')
}
await localPackage.install(codePush.InstallMode.IMMEDIATE, 0)
}
catch (error) {
captureException('codePush', error)
}
}
const onProgress = ({ receivedBytes, totalBytes}) => {
const percent = receivedBytes / totalBytes
window.updateDownloadPercent = round2decimals(percent * 100)
}
The issue is called just by the act of downloading the remotePackage.
Any updates on this?
This error often occurs. Is there a solution?
@dkahdwk @Zakyyy see my workaround here:
https://github.com/microsoft/react-native-code-push/issues/2585#issuecomment-1749375271
Well this is very much still an issue. An update that was detected but failed to download should be tried again later instead of being marked as rolled back. This issue should remain open.
Initial sync()
call, very soon after publishing an update:
[CodePush] Checking for update.
[CodePush] Downloading package.
[CodePush] An unknown error occurred.
[CodePush] Received 404 response from https://codepush-secondary.blob.core.windows.net/storagev2/xxxxxxxxxxxxxxxxxxxxxxxxx
An update is detected, yet its download fails. It would be better if it didn't but hey, stuff happens.
Subsequent sync()
call:
[CodePush] Checking for update.
[CodePush] An update is available, but it is being ignored due to having been previously rolled back.
[CodePush] App is up to date.
Why an update would be considered rolled back if it didn't even succeed at the download stage? Try again here would be the expected behaviour.
@habovh i'm having the same error here, the exact same thing!
This issue is not fixed yet. It occurs in my deployments seemingly randomly.
On Fri, Jan 26, 2024 at 07:39 Roxcode @.***> wrote:
@habovh https://github.com/habovh i'm having the same error here, the exact same thing!
— Reply to this email directly, view it on GitHub https://github.com/microsoft/react-native-code-push/issues/2527#issuecomment-1912172522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB53IRLFFKDZYTMMEG4AFK3YQO53PAVCNFSM6AAAAAAYTXDYKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJSGE3TENJSGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Still an issue, though now that AppCenter is being sunset it might be harder to get a fix right now.
Since this issue also highlights a back-end issue, I guess once we get the "community version" of CodePush server to be able to self-host, we'll be able to identify and fix the issue to prevent 404 in the first place.
@habovh
Send your updates with the —disabled
flag, and then manually enable it to avoid 404 errors.
Well this is very much still an issue. An update that was detected but failed to download should be tried again later instead of being marked as rolled back. This issue should remain open.
Initial
sync()
call, very soon after publishing an update:[CodePush] Checking for update. [CodePush] Downloading package. [CodePush] An unknown error occurred. [CodePush] Received 404 response from https://codepush-secondary.blob.core.windows.net/storagev2/xxxxxxxxxxxxxxxxxxxxxxxxx
An update is detected, yet its download fails. It would be better if it didn't but hey, stuff happens.
Subsequent
sync()
call:[CodePush] Checking for update. [CodePush] An update is available, but it is being ignored due to having been previously rolled back. [CodePush] App is up to date.
Why an update would be considered rolled back if it didn't even succeed at the download stage? Try again here would be the expected behaviour.
Has this issue resolved ??
@habovh
Send your updates with the
—disabled
flag, and then manually enable it to avoid 404 errors.
@skam22 yes I'm using a similar approach where I push to staging and promote, but that's still inconvenient and IMO the update should not be considered rolled back by the client if it failed to download in the first place.
Issue is still relevant.
This is still relevant.