eas-cli icon indicating copy to clipboard operation
eas-cli copied to clipboard

Expo-updates Issue: Empty String Returned from Updates.channel on Android

Open socheatleang opened this issue 2 years ago • 8 comments

Build/Submit details page URL

No response

Summary

I am encountering an issue with the expo-updates library in my Expo project specifically on Android. Despite configuring the project correctly, I am getting an empty string when trying to access the Updates.channel.

This issue happened after I did the migration from Expo Classic Updates

Managed or bare?

Managed

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 14.1 Shell: 5.9 - /bin/zsh Binaries: Node: 14.19.2 - ~/.nvm/versions/node/v14.19.2/bin/node Yarn: 1.22.18 - /opt/homebrew/bin/yarn npm: 6.14.17 - ~/.nvm/versions/node/v14.19.2/bin/npm Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.14.3 - /opt/homebrew/bin/pod SDKs: Android SDK: Android NDK: 22.1.7171670 IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9971841 Xcode: /undefined - /usr/bin/xcodebuild npmPackages: expo: ^48.0.0 => 48.0.21 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-web: ~0.18.7 => 0.18.12 npmGlobalPackages: eas-cli: 6.0.0 expo-cli: 6.3.10 Expo Workflow: managed

Error output

No response

Reproducible demo or steps to reproduce from a blank project

eas.json

{
  "cli": {
    "version": ">= 0.48.2"
  },
  "build": {
    "development": {
      "channel": "development",
      "ios": { "image": "macos-ventura-13.3-xcode-14.3" },
      "android": { "image": "default", "buildType": "apk" }
    },
    "staging": {
      "channel": "staging",
      "ios": { "image": "macos-ventura-13.3-xcode-14.3" },
      "android": { "image": "stable" }
    },
}

command to build

eas build --profile staging

On the project. I fetch the channel by

import * as Updates from 'expo-updates';


console.log({
    channel: Updates.channel,
});

output

channel: ""

socheatleang avatar Jan 18 '24 07:01 socheatleang

Can you send me the URL of your build?

szdziedzic avatar Jan 18 '24 10:01 szdziedzic

Hi. @szdziedzic . Thanks for reponse. Here is url: https://expo.dev/accounts/defit/projects/defit/builds/760b85ef-6966-43e6-95d0-8f3ffa36960e

socheatleang avatar Jan 18 '24 10:01 socheatleang

OK, I see that the configure expo-updates step was executed successfully 🤔

Screenshot 2024-01-18 at 11 04 21

How do you launch your built app and inspect this channel value?

szdziedzic avatar Jan 18 '24 10:01 szdziedzic

import * as Updates from 'expo-updates';

console.log({
    channel: Updates.channel,
});

I get the channel by Updates.channel.

socheatleang avatar Jan 18 '24 10:01 socheatleang

I am on the

"expo-updates": "~0.16.4"

socheatleang avatar Jan 18 '24 10:01 socheatleang

@szdziedzic ? .

socheatleang avatar Jan 18 '24 11:01 socheatleang

hey @socheatleang this is expected behaviour in the development client, though I understand the UX is jarring (sorry!). Your android app looks correctly configured though, so a normal build should have the Updates.channel show up.

Expo Go and development builds are not set to a specific channel and can run any updates compatible with their native runtime. Therefore, this value will always be null when running an update on Expo Go or a development build.

Doc details: https://docs.expo.dev/versions/latest/sdk/updates/#updateschannel

quinlanj avatar Jan 30 '24 00:01 quinlanj

Same for me,

Updates.channel is alway null (or equivalent)

expo 49.0.22 expo-updates: 0.18.19

running eas build -p android --profile qualif-49-internal

part of my eas.json concerned:

  "build": {
    "qualif-49-internal": {
      "channel": "qualif-49",
      "android": {
        "buildType": "apk"
      }
    }
  }

Did I miss something or is it a bug ?

iNath avatar Feb 01 '24 10:02 iNath

Hello ! It's also happening for us

eas update:configure
💡 The following process will configure your project to use EAS Update. These changes only apply to your local project files and you can safely revert them at any time.
✔ Configured eas.json.

🎉 Your app is configured to use EAS Update!

eas.json

   "production": {
      "channel": "production",
      "environment": "production",
      "env": {
        ...
      },
    }

Debugging a production build with Alert.alert('Updates.channel', Updates.channel);

Image

tlenclos avatar Feb 27 '25 13:02 tlenclos