Unable to publish OTA updates in expo bare app

Hello,
I have switched to bare workflow from the managed one, as some native code was needed. In managed workflow I was using expo build and expo publish for my releases and OTA updates. Now as I have shifted to bare flow I’m using cmd prompt for builds. Everything was working fine, but when I tried to publish OTA update using publish cmd app crashes.

  1. “expo-updates”: “^0.2.7”
  2. “expo”: “^37.0.12”
    Followed the complete procedure as per docs but unable to resolve the bug.

Error log :
com.facebook.react.common.JavascriptException: Error: The Expo SDK requires Expo to run. It appears the native Expo modules are unavailable and this code is not running on Expo. Visit https://docs.expo.io to learn more about developing an Expo project., stack:
@13:185
v@2:1474
@9:67
v@2:1474
@8:191
v@2:1474
@6:48
v@2:1474
d@2:876
global code@1902:4
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
at java.lang.reflect.Method.invoke (Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:371)
at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:150)
at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
at android.os.Handler.handleCallback (Handler.java:883)
at android.os.Handler.dispatchMessage (Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:26)
at android.os.Looper.loop (Looper.java:237)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:225)
at java.lang.Thread.run (Thread.java:919)

Details about the ejected project:
app.json:
“expo”: {

"packagerOpts": {

  "config": "metro.config.js",

  "sourceExts": [

    "js",

    "jsx",

    "ts",

    "tsx",

    "svg"

  ],

  "transformer": "node_modules/react-native-svg-transformer/index.js"

},

"name": "xxx",

"slug": "xxx",

"privacy": "public",

"platforms": [

  "ios",

  "android",

  "web"

],

"sdkVersion": "37.0.0",

"version": "1.0.5",

"orientation": "portrait",

"icon": "./assets/icon.png",

"splash": {

  "image": "./assets/splash.png",

  "resizeMode": "contain",

  "backgroundColor": "#B12E21",

  "imageStyle": {

    "top": 40

  }

},

.
.
.
.

"updates": {

  "enabled": true,

  "fallbackToCacheTimeout": 0

},

"assetBundlePatterns": [

  "**/*"

],

.
.
},
“entryPoint”: “node_modules/expo/AppEntry.js”

},

metro.config.js :
.
.
.
transformer: {

  babelTransformerPath: require.resolve('react-native-svg-transformer'),

  assetPlugins: ['expo-asset/tools/hashAssetFiles'],

},

.
.

I have tried creating new project but not able to find out the issue.
FYI: I have also gone through

Is there anyone who can help me out of this?
Thanks in advance!

I just found out my OTA updates don’t work anymore since moving to bare workflow in Expo 38. I’ll let you know if I figure out how to get it working.

1 Like

Did you figure out how to fix this issue?

@fragmnt02, what error are you getting? What does expo diagnostics give you?

Hi @abhijeet_ardouro

Basically, when you’re using the bare workflow you can’t have import ... from 'expo' anywhere in your code.

After a bit of research we believe the problem is that we’re importing AppLoading which is not available in the bare workflow. What we don’t yet understand is why the app runs well when we build and publish with XCode and crashes only after an OTA update.

Is this the expected behavior?

Unless the original build did not include references to expo where the OTA update does, I don’t know, but it does seem strange to me otherwise.

We’re still having this issue. Bare workflow app works if built from XCode, as soon as we send OTA the app instantly crashes. With SDK 39 the crash error has changed to:

Error: Expo native runtime is not available: something went wrong and we aren’t sure what it was. Please post more information and get support at https://forums.expo.io.’, reason: 'Unhandled JS Exception: Error: Expo native runtime is not available: something went wrong and we aren’t sure what it was. Please post more information and get support at https…

Our app has now only one reference to ‘expo’, in index.js we are importing registerRootComponent.

Looking at a new bare template we see that registerRootComponent is part of the main template so we’re not sure if we should be removing this file/reference.

Also, can/should we remove ‘expo’ dependency from package.json?

Expo diagnostics

Expo CLI 3.27.8 environment info:
  System:
   OS: macOS 10.15.5
   Shell: 5.7.1 - /bin/zsh
  Binaries:
   Node: 14.11.0 - /usr/local/bin/node
   Yarn: 1.22.5 - /usr/local/Cellar/node/14.11.0/bin/yarn
   npm: 6.14.5 - /usr/local/bin/npm
   Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
   CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
   iOS SDK:
    Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
  IDEs:
   Xcode: 12.0/12A7209 - /usr/bin/xcodebuild
  npmPackages:
   expo: ^39.0.0 => 39.0.3 
   react: 16.13.1 => 16.13.1 
   react-dom: 16.13.1 => 16.13.1 
   react-native: ~0.63.2 => 0.63.2 
   react-native-web: ~0.13.12 => 0.13.13 
  npmGlobalPackages:
   expo-cli: 3.27.8
  Expo Workflow: bare

when you run expo publish with a recent version of expo-cli from a bare project it will automatically set the target to “bare” which results in excluding any .expo.js files. this means that the file with this error message would not be included in your bundle. you can see the target when you run the publish command:

╭─~/code/brentapp ‹master›
╰─$ expo publish

- Release channel: default
- Workflow: Bare

if you publish from a branch where you haven’t ejected and see Workflow: managed on running the command then it will not be compatible with your binary. i don’t know exactly what happened in your case but i suspect something like this


you can remove the expo package if you like. it’s main purposes here are to make it so imports from the package continue to work and you can continue using expo client if you want.

1 Like

Thanks Brent! That was the issue. OTA updates are working properly now :clap: