From 9a1e782b7623c0ec3f294c8d84491cccd3027062 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Wed, 13 Mar 2024 17:46:50 -0300 Subject: [PATCH] [cli] Fix 'Tunnel URL not found' warning when starting bundler (#27566) # Why Running `npx expo start --tunnel` in SDK 50 always results in a warning being thrown about the tunnel URL not being ready image The problem in this case is the order which things get executed. The `debugMiddleware` has to be created before we initialize the metro server, given that we need to know the `debugWebsocketEndpoints` beforehand, and ngrok is only initialized inside `postStartAsync`. # How This warning happens because we were calling `metroBundler.getJsInspectorBaseUrl()` before Metro was fully initiated. This PR fixes this by using the `.getUrlCreator().constructUrl` function directly. # Test Plan Run `npx expo start --tunnel` and see no warning # Checklist - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --- .../src/start/server/metro/debugging/createDebugMiddleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@expo/cli/src/start/server/metro/debugging/createDebugMiddleware.ts b/packages/@expo/cli/src/start/server/metro/debugging/createDebugMiddleware.ts index 62d5e91d7de6b..87bcc6f874a4b 100644 --- a/packages/@expo/cli/src/start/server/metro/debugging/createDebugMiddleware.ts +++ b/packages/@expo/cli/src/start/server/metro/debugging/createDebugMiddleware.ts @@ -19,7 +19,7 @@ export function createDebugMiddleware(metroBundler: MetroBundlerDevServer) { const { middleware, websocketEndpoints } = createDevMiddleware({ projectRoot: metroBundler.projectRoot, - serverBaseUrl: metroBundler.getJsInspectorBaseUrl(), + serverBaseUrl: metroBundler.getUrlCreator().constructUrl({ scheme: 'http', hostType: 'lan' }), logger: createLogger(chalk.bold('Debug:')), unstable_InspectorProxy: ExpoInspectorProxy, unstable_experiments: {