expo: [Expo 50] Unable to load dev client bundle on Android device (expo-dev-client@3.3.8)
Minimal reproducible example
https://github.com/vivek-pai/expo-reproducible-example
Summary
This is a continuation of issue #26364. I am still seeing the same error on the Android dev client build with expo-dev-client 3.3.8:
There was a problem loading the project.
This development build encountered the following error.
Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
The linked reproducible example is just from running npx create-expo-app and installing the dev client.
I use WSL and build the dev client
eas build --profile development --platform android
and then run
expo start --dev-client --tunnel
Upon running, I’ll see the following warning
**Tunnel URL not found (it might not be ready yet), falling back to LAN URL.**
Starting Metro Bundler
Tunnel connected.
Tunnel ready.
But, it still provides a usable url:
› Metro waiting on exp+expo-test://expo-development-client/?url=https%3A%2F%2Fxxxxxx-y-8081.exp.direct
Connecting to that URL from my dev client (on my Android device), I get the “Unable to load script” error
To rule out the tunnel warning being an issue, I started without the expo tunnel
expo start --dev-client
› Metro waiting on exp+expo-test://expo-development-client/?url=http%3A%2F%2F172.20.72.246%3A8081
and used localtunnel to create a public accessible tunnel
npx localtunnel --port 8081
Connected to that public address from my Android dev client=> Same “Unable to load script” error
In all attempts, I don’t see any “BUNDLE” or any other entries in the console.
The iOS dev client works fine, however. The non-dev client Android/iOS builds also work. This error only occurs on the Android dev client.
Environment
expo-env-info 1.2.0 environment info:
System:
OS: Linux 5.10 Ubuntu 20.04.6 LTS (Focal Fossa)
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
npmPackages:
expo: ~50.0.6 => 50.0.6
react: 18.2.0 => 18.2.0
react-native: 0.73.4 => 0.73.4
npmGlobalPackages:
eas-cli: 7.1.3
Expo Workflow: managed
WSL 2
Samsung Galaxy S22
Android 14
About this issue
- Original URL
- State: open
- Created 5 months ago
- Reactions: 16
- Comments: 30 (9 by maintainers)
Same, but seems to work if i load it with http://<tunnelurl>
^^ Thanks @wodin for referring me to this ticket. I had a team member hit this issue and was struggling to get past it. When I heard they got it to work if they changed the URL to HTTP, I thought it might be a cert issue.
This is what I shared over on discord:
A team member was struggling today to get Expo Direct to work. They ended up figuring out if they downgraded to http:// in the url, things worked. I took a look and found out that when expo direct generated the URL it is using their Expo username like so:
{random-hash}-{expousername}-8081.exp.directthe Lets Encrypt cert is a
*.exp.direct cert. Certificates, including wildcard certs, only cover the same subdomain they are issued for. They cannot cover n-deep subdomains. So what was happening was his expo username had a period in it, lets pretend his username wasmyuser.namethis resulted in the following URL being generated for Expo Direct:pgtnlz1-myuser.name-8081.exp.directWhile Expo infrastructure can route him correctly, the cert from Lets encrypt only coveredname-8081.exp.directsubdomain. When accessingpgtnlz1-myuser.name-8081.exp.directunder HTTPs you get a certificate exception aspgtnlz1-myuseris a subdomain and can’t be covered by the cert.I advised my co-worker to change his username on expo and remove the
.from his username so that when Expo creates the random URL under the*.exp.directit would all be on the same DNS zone. Once he did this, everything worked correctly.Until expo changes the algorithm they use to create expo direct URLs, you must change your username if it has a period
.in the username.I can confirm I do not have a need for tunnel. I used it because the regular connection was not working which I solved by updating node.
If there is still a need for tunnel regardless then I think the manipulation from ‘https’ to ‘http’ is still required.
Update: I have managed to solve this by updating my node to the LTS version. Make sure to clean node cache as well to set up the correct version. I am running 20.12.0 and then there is no need for any tunnel or url manipulation.
@wodin was able to shed some more detail on the background of this issue:
So these appear to be the combined insights:
--tunnelused to usehttpbut now useshttpsinstead (as per @wodin)httpURL appears to be a workaround for everyone who has this issueAll things considered, it would be great to have an acknowledgement from the Expo team, in particular for someone who was involved in making the move from
httptohttps, who in turn may be able to shed some light on whether that is still a good idea even with the issue reported here.