question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

metro bundler crashes at start with error: Error: Must specify expo-platform header or query parameter

See original GitHub issue

Summary

When I start metro bundler with expo start --dev-client, Metro bundler crashes with error:

Error: Must specify expo-platform header or query parameter
    at getPlatformFromRequest (.../node_modules/expo-cli/node_modules/xdl/src/start/ExpoUpdatesManifestHandler.ts:34:11)

I have a valid develop build in eas.json:

  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
    },
 }

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android, iOS

Package versions

expo-dev-client : 0.9.5 expo-updates : 0.13.1

Environment

  expo-env-info 1.0.3 environment info:
    System:
      OS: macOS 12.3.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.1 - /var/folders/fs/mgcn9dds60114gl150cz1fk40000gn/T/yarn--1652390571976-0.8778512103665701/node
      Yarn: 1.22.15 - /var/folders/fs/mgcn9dds60114gl150cz1fk40000gn/T/yarn--1652390571976-0.8778512103665701/yarn
      npm: 8.3.0 - ~/.nvm/versions/node/v14.18.1/bin/npm
      Watchman: 2021.11.15.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.11.3 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    IDEs:
      Android Studio: 2020.3 AI-203.7717.56.2031.7935034
      Xcode: 13.2/13C5081f - /usr/bin/xcodebuild
    npmPackages:
      expo: ^45.0.0 => 45.0.1 
      react: 17.0.2 => 17.0.2 
      react-dom: 17.0.2 => 17.0.2 
      react-native: 0.68.1 => 0.68.1 
      react-native-web: 0.17.7 => 0.17.7 
    npmGlobalPackages:
      eas-cli: 0.52.0
      expo-cli: 5.4.3
    Expo Workflow: managed

Reproducible demo

This crash is not consistent.

  1. create a new expo project: expo init
  2. add dev-client with a development profile
  3. run expo start --dev-client

Stacktrace (if a crash is involved)


23:18
Error: Must specify expo-platform header or query parameter
    at getPlatformFromRequest (.../node_modules/expo-cli/node_modules/xdl/src/start/ExpoUpdatesManifestHandler.ts:34:11)
    at /.../node_modules/expo-cli/node_modules/xdl/src/start/ExpoUpdatesManifestHandler.ts:207:19
    at call (/.../node_modules/connect/index.js:239:7)
    at next (/.../node_modules/connect/index.js:183:5)
    at Function.handle (/.../node_modules/connect/index.js:186:3)
    at handle (/.../node_modules/connect/index.js:91:14)
    at call (/.../node_modules/connect/index.js:239:7)
    at next (/.../node_modules/connect/index.js:183:5)
    at Function.handle (/.../node_modules/connect/index.js:186:3)
    at Server.app (/.../node_modules/connect/index.js:51:37)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:7
  • Comments:31 (8 by maintainers)

github_iconTop GitHub Comments

9reactions
jakobocommented, Jul 29, 2022

I’m starting Metro Bundler with the Node script of npm run esd (esd = expo start dev) A development build can be created with npm run ebd (ebd = eas build dev)

I was able to reproduce this using @OneHatRepo’s example. Local builds using the simulator work, but attempting to use the custom developer client on a physical iOS device generates the Error: Must specify expo-platform header or query parameter error. I traced the error to ExpoUpdatesManifestHandler, which seems to be invoked when Flipper asks for the event log as part of metro connection.

I don’t realistically think we’re going to fix this from the flipper side. However, I was able to connect to an on-device Hermes app with the following start command which bypasses the expo update manifest:

expo start --dev-client --force-manifest-type=classic

However, I couldn’t tell you what the implications of doing this are for a custom dev client since the updates manifest is usually relevant for adhoc/testflight/production updates.

5reactions
OneHatRepocommented, Jul 2, 2022

Using the minimal test app, expo run did work in generating a development build that could connect to Flipper and debug through the Hermes Debugger, but also threw me into the bare workflow, which I did not want.

Using eas build to generate a development build caused the error to return in Metro Bundler when I tried to connect through Flipper. Metro Bundler didn’t actually crash, but it continually spit out error messages like the one shown below.

Metro Bundler

Flipper sees the app but shows the Hermes debugger as unavailable, as shown.

Flipper

Here is the minimal app’s code in question: https://github.com/OneHatRepo/MetroBundlerError

I’m starting Metro Bundler with the Node script of npm run esd (esd = expo start dev) A development build can be created with npm run ebd (ebd = eas build dev)

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Metro Bundler Crashing - node.js - Stack Overflow
The metro builder crashes almost instantaneously as soon as I start the application. This happens with expo and react native cli apps both....
Read more >
Latest Expo SDK topics - Forums
Topic Replies Views Activity Problem with facebook login using firebase oauth 1 51 June 20, 2022 Adjusting PixelRatio in React Native Manually 3 47 June...
Read more >
@expo/metro-config | Yarn - Package Manager
A Metro config for running React Native projects with the Metro bundler. Exotic. When enabled, exotic mode adds the following assumptions:.
Read more >
Error in event log after game crashes. wmiaprpl - Microsoft Q&A
My game keeps crashing after the initial startup-bootup for the game, then it constantly crashes. there was no change in between. error on ......
Read more >
Wrong retry sending data packet when shard size changed.
Documentation inconsistent with db/backup usage, 2, 2021-03-17, 2022-12-11 ; metro bundler crashes at start with error: Error: Must specify expo-platform header ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found