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

Bundle html assets cannot be loaded from app updates published on expo.dev #1940

Open
oliverwelter opened this issue Jul 20, 2023 · 2 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@oliverwelter
Copy link

Build/Submit details page URL

https://expo.dev/accounts/nia-medtech/projects/nia-app

Summary

When using html files as bundled assets these assets cannot be loaded from builds hosted on expo.dev.

Running the build locally on a laptop and loading it into a devclient within the same local network via QR code works.
But loading the QR code from a build provided on expo.dev leads to the attached error screen:

Screenshot_20230720_101933_Nia (Dev)

The problem seems to be limited to files with suffix "html", ppg, png and pdf assets work without any issue.
Also changing the suffix from "html" to "htm" works.

Managed or bare?

Managed

Environment

expo-env-info 1.0.5 environment info:
System:
OS: Linux 6.1 Gentoo Linux
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.20.1 - /usr/bin/node
Yarn: 3.6.0 - ~/nia-health/nia/nia-app/node_modules/.bin/yarn
npm: 8.19.4 - /usr/bin/npm
npmPackages:
babel-preset-expo: ^9.3.0 => 9.3.1
expo: ^48.0.18 => 48.0.18
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.71.8 => 0.71.8
react-native-web: ~0.18.9 => 0.18.12
Expo Workflow: managed

✔ Validating global prerequisites versions
✔ Checking for incompatible packages
✔ Verifying prebuild support package versions are compatible
✔ Checking dependency versions for compatibility with the installed Expo SDK
✔ Validating Expo Config

Didn't find any issues with the project!

Error output

No response

Reproducible demo or steps to reproduce from a blank project

  • Create a new project
  • Configure to use a devclient
  • Build and install devclient
  • Configure assets bundle pattern in app.json, e.g. like "assetBundlePatterns": ["**/assets/**/*"],
  • Add a valid html file to the assets directory, e.g "assets/example.html"
  • Add following line of code in a react native component:
    const assets = useAssets( [require("./assets/example.html")]);
  • Publish to expo.dev by running: eas-cli update
  • Open build on expo.dev and scan QR code via camera app
@oliverwelter oliverwelter added the needs review Issue is ready to be reviewed by a maintainer label Jul 20, 2023
@oliverwelter
Copy link
Author

oliverwelter commented Jul 20, 2023

It looks like the asset could be downloaded but the SHA256 values of are different.
See logcat output:

Failed to download asset with key 34a2be7de23f091d89578190e29eb9ed java.io.IOException: File download was successful but base64url-encoded SHA-256 did not match expected; expected: czOH3XNk-XoNNkEVEuBWHkSdR8SGEDoCXL3PJ6siogo; actual: s5ok79vZRepJAcx_r13wCxAx403f2D9Ghrl9B7GE_LI at expo.modules.updates.UpdatesUtils.verifySHA256AndWriteToFile(UpdatesUtils.kt:131) at expo.modules.updates.loader.FileDownloader$downloadFileAndVerifyHashAndWriteToPath$1.onResponse(FileDownloader.kt:81) at expo.modules.updates.loader.FileDownloader$downloadData$1.onResponse(FileDownloader.kt:393) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012) 2023-07-20 10:38:58.310 27767-27913 Loader de....alth.niaapp.developmentclient E Failed to download asset with key 95c3c048ab131377a9b534085f3360de java.io.IOException: File download was successful but base64url-encoded SHA-256 did not match expected; expected: 0aRij35rHWAFCFrfRhv6nmQxTXES4_v6ZP0Jy6kH59s; actual: Lx48sTN1Pt-p8HOsCyghszuWJQuHn7SjC965hATO9Qw at expo.modules.updates.UpdatesUtils.verifySHA256AndWriteToFile(UpdatesUtils.kt:131) at expo.modules.updates.loader.FileDownloader$downloadFileAndVerifyHashAndWriteToPath$1.onResponse(FileDownloader.kt:81) at expo.modules.updates.loader.FileDownloader$downloadData$1.onResponse(FileDownloader.kt:393) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012) 2023-07-20 10:38:58.609 27767-27881 Loader de....alth.niaapp.developmentclient E Failed to load all assets java.lang.Exception: Failed to load all assets at expo.modules.updates.loader.Loader.handleAssetDownloadCompleted(Loader.kt:303) at expo.modules.updates.loader.Loader.downloadAllAssets(Loader.kt:229) at expo.modules.updates.loader.Loader.processUpdateManifest(Loader.kt:196) at expo.modules.updates.loader.Loader.access$processUpdateManifest(Loader.kt:25) at expo.modules.updates.loader.Loader$start$1.onSuccess(Loader.kt:108) at expo.modules.updates.loader.FileDownloader$Companion.checkCodeSigningAndCreateManifest(FileDownloader.kt:468) at expo.modules.updates.loader.FileDownloader$Companion.access$checkCodeSigningAndCreateManifest(FileDownloader.kt:398) at expo.modules.updates.loader.FileDownloader.parseManifest(FileDownloader.kt:274) at expo.modules.updates.loader.FileDownloader.parseMultipartManifestResponse(FileDownloader.kt:206) at expo.modules.updates.loader.FileDownloader.parseManifestResponse$expo_updates_debug(FileDownloader.kt:108) at expo.modules.updates.loader.FileDownloader$downloadManifest$1.onResponse(FileDownloader.kt:319) at expo.modules.updates.loader.FileDownloader$downloadData$1.onResponse(FileDownloader.kt:393) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

@michaelpomogajko
Copy link

Hi @oliverwelter, I'm having the same issue with the sha being different, but it seems that it also applies for non-html files.
I'm tracking my findings in this issue #2203.

Were you able to find a fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants