-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[expo-asset] Load local expo-updates manifest assets #15667
Conversation
ENG-2288 Using w/modern manifests in development produces expo-asset error with a production CloudFront URL
We don't yet know why this happens but it's definitely something we need to fix. A minimum, complete, reproducible example: https://github.com/jonsamp/mcr-expo-manifest-image-default-source I have a hunch this code is involved: https://github.com/expo/expo/blame/master/packages/expo-asset/src/AssetSources.ts#L86 Note: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (aside from the one detail) -- thanks so much for fixing this, @jonsamp!! And for the comprehensive test plan 🙏 🙏
It looks like we should probably take a pass over the rest of the getManifest()
calls in this file as well, to make them compatible with manifest2
(could also consider removing the hardcoded cloudfront URL altogether, although it has useful to have a last resort fallback at times) -- but this seems great as a hotfix for the current issue.
Co-authored-by: Eric Samelson <esamelson@users.noreply.github.com>
* adds manifest2 support during development * makes manifest2 its own function and logic * adds test * adds changelog * updates changelog * Update packages/expo-asset/src/AssetSources.ts Co-authored-by: Eric Samelson <esamelson@users.noreply.github.com> * rebuilds expo-asset * updates test Co-authored-by: Eric Samelson <esamelson@users.noreply.github.com>
Why
Fixes 4081
Closes ENG-2748, ENG-2288
As described in the issues above, there was one issue that was causing problems:
expo-updates
manifest<Image />
'sdefaultSource
prop would cause an app to error.This PR exposes the
manifest2.extra.expoGo.debuggerHost
to theselectAssetSources
function, which returns the correct local asset URLs. This makes it possible to runexpo start --force-manifest-type=expo-updates
and to load assets.How
For expo-asset to know the correct local URL, we must pass it the URL of the currently running local session. For classic manifests, we pass in the
manifest.bundleUrl
(example:http://127.0.0.1:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false
). The expo-asset library code then takes the pathname (http://127.0.0.1:19000
) and uses that to construct the asset URL.In similar fashion, I decided to take the
manifest2.extra.expoGo.debuggerHost
property (example:127.0.0.1:19000
) forexpo-updates
manifests. If this property is likely to change, we should pass another prop when running Expo CLI that is more specific, but using this one since I think it is likely stable.Test Plan
yarn
, then run the server withexpo start --force-manifest-type=expo-updates
and open the app in Expo Go in a simulator. You should see an image appear. You can also writeconsole.log(Image.resolveAssetSource(ImageOne))
, and make sure that the URL starts with a URL like "https://127.0.0.1:19000/...".expo start --force-manifest-type=classic
, to make sure that classic updates are unaffected.