expo: Expo start tunnel failed to start tunnel

Jump to official temporary workaround

Summary

Expected

When running expo start -c --tunnel it should start up a tunnel

Actual

I get this error message:

yarn start -c --tunnel                                                                                                                                                                                                           19:23:35
yarn run v1.22.18
warning ../../../../package.json: No license field
$ expo start --dev-client -c --tunnel
Starting project at /Users/adriancaroll/workspace/github/ligonier/ligonier-app
Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
watchman warning:  Recrawled this watch 7 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/adriancaroll/workspace/github/ligonier/ligonier-app' ; watchman watch-project '/Users/adriancaroll/workspace/github/ligonier/ligonier-app'`

CommandError: failed to start tunnel

remote gone away
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What platform(s) does this occur on?

Android, iOS, Web

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.3.1
      Shell: 3.2.2 - /usr/local/bin/fish
    Binaries:
      Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
      Yarn: 1.22.18 - ~/.nvm/versions/node/v16.13.0/bin/yarn
      npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
      Watchman: 2022.10.17.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.10.1 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
      Android SDK:
        API Levels: 29, 30
        Build Tools: 29.0.2, 30.0.3
        System Images: android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 4.1 AI-201.8743.12.41.7199119
      Xcode: 14.3/14E222b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~47.0.14 => 47.0.14
      react: 18.1.0 => 18.1.0
      react-dom: 18.1.0 => 18.1.0
      react-native: 0.70.8 => 0.70.8
      react-native-web: 0.18.9 => 0.18.9
    npmGlobalPackages:
      eas-cli: 3.9.1
      expo-cli: 6.3.2
    Expo Workflow: bare

Minimal reproducible example

Simply run the following in a terminal:

expo start -c --tunnel

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 31
  • Comments: 74 (7 by maintainers)

Most upvoted comments

This is really hammering my ability to work.

Investigating now.

Just a few quick things to try and mitigate the duplicate comments that may be throwing people off:

  • --clear clears the babel cache and has no overlap with tunneling a URL.
  • --dev-client changes the port of the URL this also should have no sway over ngrok working or not.
  • The patch version of Expo CLI probably has nothing to do with ngrok support, ngrok is an external package that we rarely update.

Update 1

The Expo account may have been suspended, I don’t see any clear indication of that outside of the error code which seems to be related to suspension.

Users can change the API token in Expo CLI to use their own account as a temporary workaround. This file is located under node_modules/@expo/cli/build/src/start/server/AsyncNgrok.js – haven’t confirmed if this works yet.

Update 2

Confirmed the temporary workaround works:

const NGROK_CONFIG = {
+  authToken: 'XXXXXX',
-   authToken: '5W1bR67GNbWcXqmxZzBG1_56GezNeaX6sSRvn8npeQ8',
-   domain: 'exp.direct',
};
  • Then comment out the subdomain usage:
const url = await instance.connect({
+  // ...urlProps,
-   ...urlProps,
    authtoken: NGROK_CONFIG.authToken,
    proto: "http",
    configPath,

Failure to remove the subdomain may result in a Only Personal, Pro and Enterprise plans ... error (ERR_NGROK_313)

The resulting URL will look something like exp://1419-72-181-50-55.ngrok-free.app

You can use npx patch-package @expo/cli then add the script "prepare": "npx patch-package" to your package.json scripts object to keep this change working across installs.

  • This solution will not work with EXPO_TUNNEL_SUBDOMAIN set.

Still investigating why the official token is no longer working.

Update 3

We have been able to contact Ngrok and get the default key reinstated. Tested and I can confirm it works. If you added the patch, you can now revert it to the default key.

Sorry for any inconvenience they may have caused.

Access to the Expo Ngrok account has been restored and the --tunnel functionality is now working again, no workarounds necessary, sorry for the inconvenience

everyone. stop making unnecesary comments. asking if it’s fixed or saying you have the same problem only causes more spam for those of us actually waiting for a fix. if you have nothing to add, upvote the original post and / or suscribe to the issue to get notified of updates

I have the same error and started arout the same time this post was posted.

I was having this issue too, seems to be resolved now for me, using "expo":"~47.0.13"

Update: this resolved it temporarily but it’s failing again, switches between these 2 error messages CommandError: TypeError: Cannot read properties of undefined (reading 'body') CommandError: failed to start tunnel remote gone away

Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

Also having this issue. Started tonight.

Roll back to "expo": "~48.0.6", from 48.0.10 in package.json to get this working again.

Same for me. Was working yesterday, April 18, but started bugging over the night (11 PM CET). This morning, tried updating node modules, react, react native, ngrok Initially got ngrok error message. Worked once this morning, and failed again. Now after reinstalling node modules getting

CommandError: TypeError: Cannot read properties of undefined (reading ‘body’)

or

CommandError: ngrok tunnel took too long to connect.

Good morning,

It still doesn’t work. It’s starting to get really blocking, can we have some news please?

Same here. I get two messages occasionally:

Starting Metro Bundler
CommandError: failed to start tunnel
 
session closed

or

Starting Metro Bundler
CommandError: failed to start tunnel
 
remote gone away

tunnel stops working for me today as well

session closed tunnel took to long to connect Cannot read properties of undefined (reading ‘body’)

help-

I just got this today too:

npx expo start --tunnel

Starting Metro Bundler CommandError: failed to start tunnel

remote gone away

Edit: It is now working after waiting for some time… I have not done anything… strange

Edit 2:

Update: this resolved it temporarily but it’s failing again, switches between these 2 error messages CommandError: TypeError: Cannot read properties of undefined (reading ‘body’) CommandError: failed to start tunnel remote gone away

Same experience

@acognigni-evotecnia solution updated

@EvanBacon (update 2)

is it possible that the update 2 solution only works if you have a paid account?

i’m getting an error saying Only Personal, Pro and Enterprise plans may bind custom hostnames. Failed to bind the custom hostname 'qi6m2ew.anonymous.19001' for the account 'my@email.com'. This account is on the 'Free' plan.

Just tried npx expo start -c --tunnel again and it started working for me right now

It’s still not working for me. Based on the comments above, it sounds like this server has been going up and down throughout the day yesterday.

This is an interesting dependency that I didn’t know I had in my development flow. I’m trying to figure out how to work around it. I normally run npx expo start --dev-client --tunnel and that causes the issue, but when I drop the --tunnel command then the server starts up. But when I scan the QR code it’s trying to direct to https://127.0.0.1:8081 which is not visible to the outside so it fails.

Notably, expo is using ngrok for it’s tunnel. But ngrok is not down. I’ve downloaded the ngrok NPM module directly, created an account, and I’m able to start up a tunnel to my machine and another local web server that I start up.

I just can’t figure out how to get expo to use my existing tunnel rather than its own. Maybe this is just a QR code thing? I’m still digging, but sharing this in case anyone else has ideas…

Same Problem …

Any fixes yet, cause I have been facing this issue since morning.

Can it be a problem in @expo/ngrok?

I am also facing the same issue: CommandError: failed to start tunnel

remote gone away

Please help me to solve this issue.

Same issue here. yarn start tunnel was working yesterday but now it doesn’t anymore.

Having the same problem here in Zimbabwe.

` Starting Metro Bundler warning: Bundler cache is empty, rebuilding (this may take a minute) CommandError: failed to start tunnel

remote gone away `

same issue today , falling back to LAN URL!

same problem, need it to continue development

Having the same problem here in Spain.

` Starting Metro Bundler warning: Bundler cache is empty, rebuilding (this may take a minute) CommandError: failed to start tunnel

remote gone away `

Experiencing the same following errors:

  • remote gone away
  • session closed
  • Cannot read properties of undefined (reading ‘body’)

None of the provided temporary solutions have worked. Anyone find a working solution?

I just got this today too:

npx expo start --tunnel

Starting Metro Bundler CommandError: failed to start tunnel

remote gone away

Same here

I just got this today too:

npx expo start --tunnel

Starting Metro Bundler CommandError: failed to start tunnel

remote gone away

same here

Also having this issue. Started tonight.

Roll back to "expo": "~48.0.6", from 48.0.10 in package.json to get this working again.

This is useful for now, thanks friend

npx expo start --dev-client --port 80

bruh that just worked, youre a lifesaver, been on this the whole day

Oh wait, success! On my dev machine which has no ports exposed to the outside, I open two terminal windows. In one:

npx expo start --dev-client --port 80

In the other I run:

ngrok http --subdomain=keith-expo --log stdout 80

In my iOS Expo Go build there is a place to enter URL manually. I give it: http://keith-expo.ngrok.io/

The placeholder text there suggests that you can enter a port after the URL, but I’m finding that it’s ignored every time so the steps above were what I had to do in order to get everything listening and responding on port 80.

This is an interesting dependency that I didn’t know I had in my development flow. I’m trying to figure out how to work around it. I normally run npx expo start --dev-client --tunnel and that causes the issue, but when I drop the --tunnel command then the server starts up. But when I scan the QR code it’s trying to direct to https://127.0.0.1:8081 which is not visible to the outside so it fails.

Notably, expo is using ngrok for it’s tunnel. But ngrok is not down. I’ve downloaded the ngrok NPM module directly, created an account, and I’m able to start up a tunnel to my machine and another local web server that I start up.

I just can’t figure out how to get expo to use my existing tunnel rather than its own. Maybe this is just a QR code thing? I’m still digging, but sharing this in case anyone else has ideas…

I had this problem too, but I made a QR code with exp://[My-lan-ip]:[port] and I can now connect without using --tunnel. I think the qrcode/link is not getting the right ip address to share

Mesmo problema …

Please tell a workaround to solve it npx expo start --tunnel Starting project at /project/home/vaib215/workspace Starting Metro Bundler CommandError: failed to start tunnel

remote gone away

Same issue today.

Having the exact same issue since this morning

Same here… it is beeing frustrating

Starting Metro Bundler CommandError: TypeError: Cannot read properties of undefined (reading ‘body’)

Is there a solution to this problem? I got the same one and can’t figure out how to xolve it

Starting Metro Bundler warning: Bundler cache is empty, rebuilding (this may take a minute) CommandError: failed to start tunnel

remote gone away

npx expo start --tunnel Starting Metro Bundler CommandError: failed to start tunnel

remote gone away

showing the above error since this afternoon

anyone found the solution?

Same here…

Yup, same problem…was working fine in the morning yesterday but wouldn’t work when I attempted again at ~6pm EST.

Starting Metro Bundler
CommandError: TypeError: Cannot read property 'body' of undefined

same probleme …

I have the same problem when using npx expo start --tunnel but when i tried npx expo start then it worked. i’m using expo 48.0.6 and react native 0.71.6

Having the same problem

Same issue here - Yesterday (CET) everything worked. This morning keep getting either CommandError: TypeError: Cannot read properties of undefined (reading 'body') or CommandError: NgrokClientError: failed to start tunnel

This is blocking because I need this due to a network limitation in our offices to continue developping our app…

Have the same error, cannot start project with tunnel.

  1. I Tried clearing bundler cache , but did not work !!

npx expo start --clear --tunnel

warning: Bundler cache is empty, rebuilding (this may take a minute)
CommandError: TypeError: Cannot read properties of undefined (reading ‘body’)

  1. Without clearing cache flag also did not work !!

npx expo start --tunnel

Starting Metro Bundler CommandError: failed to start tunnel

session closed

Having the same issue. Sometimes it displays this as well: CommandError: TypeError: Cannot read properties of undefined (reading ‘body’)

Also having this issue. Started tonight. Roll back to "expo": "~48.0.6", from 48.0.10 in package.json to get this working again.

I rolled back from 48.0.11, but it didn’t work.

Seems independent of expo version, I have tried several different ones.

Also having this issue. Started tonight.

Roll back to "expo": "~48.0.6", from 48.0.10 in package.json to get this working again.

I rolled back from 48.0.11, but it didn’t work.