Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 error when trying to download recent updates #2527

Open
Gamote opened this issue May 30, 2023 · 19 comments
Open

404 error when trying to download recent updates #2527

Gamote opened this issue May 30, 2023 · 19 comments

Comments

@Gamote
Copy link

Gamote commented May 30, 2023

Steps to Reproduce

  1. Publish an update
  2. Trigger a sync in the next 30 seconds
  3. 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

@Gamote
Copy link
Author

Gamote commented May 31, 2023

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.

@alwyntan
Copy link

It's happening to us too and it's making it quite tricky to fix critical bugs

@jameskennethrobinson
Copy link

Also seeing this!

@Gamote
Copy link
Author

Gamote commented Jun 18, 2023

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.

@ajitaro
Copy link

ajitaro commented Jun 28, 2023

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.

Screenshot 2023-06-28 at 11 14 17

@skinsapp
Copy link

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.

@Zakyyy
Copy link

Zakyyy commented Sep 7, 2023

Any updates on this?

@dkahdwk
Copy link

dkahdwk commented Sep 19, 2023

This error often occurs. Is there a solution?

@skam22
Copy link

skam22 commented Oct 5, 2023

@dkahdwk @Zakyyy
see my workaround here:

#2585 (comment)

@habovh
Copy link

habovh commented Jan 25, 2024

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.

@Victor-Roxcode
Copy link

@habovh i'm having the same error here, the exact same thing!

@jameskennethrobinson
Copy link

jameskennethrobinson commented Jan 26, 2024 via email

@habovh
Copy link

habovh commented Mar 27, 2024

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.

@skam22
Copy link

skam22 commented Mar 27, 2024

@habovh

Send your updates with the —disabled flag, and then manually enable it to avoid 404 errors.

@JasoliyaShruti
Copy link

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
Copy link

habovh commented Mar 28, 2024

@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.

@habovh
Copy link

habovh commented May 28, 2024

Issue is still relevant.

@habovh
Copy link

habovh commented Jul 28, 2024

This is still relevant.

@habovh
Copy link

habovh commented Sep 26, 2024

Issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests