Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAS Update not working for internal distribution on iOS #2714

Open
dtomaszewski opened this issue Nov 21, 2024 · 1 comment
Open

EAS Update not working for internal distribution on iOS #2714

dtomaszewski opened this issue Nov 21, 2024 · 1 comment
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@dtomaszewski
Copy link

Build/Submit details page URL

No response

Summary

Issue Summary

I am unable to get my preview app, which is distributed internally, to work with EAS Update. I have reviewed several related issues but have not found a solution that resolves the problem. The issues I have checked include:

I have also followed the debugging guide provided in the Expo Docs and explored various suggestions from ChatGPT and Claude. Unfortunately, nothing has resolved the issue.

Current Situation

Everything seems to be configured correctly:

  • The channel is mapped to the correct branch.
  • I can see all updates on expo.dev, but they do not appear in the app on my phone.
  • When I run the preview EAS build again, everything works as expected, and all the code is visible on the device.

However, when I attempt to make changes locally and distribute them internally for testing, the updates do not show on my phone, even though everything seems to be in order. Here's the configuration I’m using for the preview build:

"preview": {
  "distribution": "internal",
  "ios": {
    "enterpriseProvisioning": "adhoc"
  },
  "env": {
    "DB_TYPE": "production",
    "ENV": "production",
    "NODE_ENV": "production"
  },
  "channel": "preview"
}

What I Have Tried

  • Changed the branch connected to the preview channel to match the name of my Git branch.
  • Updated the versioning policy to runtimeVersion: { policy: "appVersion" }.
  • Attempted to fetch updates manually using useEffect or a user action button via expo-updates.
  • Explicitly added update parameters.
  • Explicitly added "expo-updates" as a plugin in app.config.
  • Tried various combinations of app versions (preserving the same version, incrementing the version before the update).
  • Tested all solutions I found across different issues on the web, but none of them have worked.

Question

Is it even possible to use EAS Update with an internal distribution build for iOS? I've found a lot of related issues, but no concrete solutions yet.

Any guidance or solutions would be greatly appreciated!

Managed or bare?

Managed

Environment

  expo-env-info 1.2.1 environment info:
    System:
      OS: macOS 14.4
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.15.0 - ~/.knode/bin/node
      npm: 9.5.0 - ~/.knode/bin/npm
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
    IDEs:
      Xcode: 15.4/15F31d - /usr/bin/xcodebuild
    npmPackages:
      @expo/metro-config: ^0.10.0 => 0.10.0
      expo: ^49.0.23 => 49.0.23
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.10 => 0.72.10
      react-native-web: ~0.19.6 => 0.19.11
    npmGlobalPackages:
      eas-cli: 13.3.0
    Expo Workflow: managed
{
  "scripts": {
    "ios": "expo run:ios",
    "eject": "expo eject",
    "test": "jest --watchAll",
    "start": "expo start --dev-client",
    "start:dev-client:prod": "DB_TYPE=production expo start --dev-client",
    "android": "expo run:android",
    "dev": "ENV=local expo start --dev-client",
    "dev:prod-db": "ENV=local DB_TYPE=production expo start --dev-client",
    "eas:build:run:ios": "eas build:run -p ios",
    "eas:build:simulator:ios": "eas build --profile development-simulator --platform ios",
    "eas:build:development:ios": "eas build --profile development --platform ios",
    "eas:build:preview:ios": "eas build --profile preview --platform ios",
    "eas:build:production:ios": "eas build --profile production --platform ios",
    "eas:update:preview:ios": "eas update --branch preview --message",
    "eas:update:production:ios": "eas update --branch production --message"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "resolutions": {
    "@expo/config-plugins": "~6.0.0",
    "@expo/prebuild-config": "~6.0.0"
  },
  "dependencies": {
    "@expo-google-fonts/poppins": "^0.2.2",
    "@expo-google-fonts/titan-one": "^0.2.2",
    "@expo/config-plugins": "^7.2.2",
    "@expo/metro-config": "^0.10.0",
    "@expo/prebuild-config": "^6.2.4",
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-community/netinfo": "9.3.10",
    "@react-navigation/native": "^6.0.4",
    "@react-navigation/stack": "^6.0.9",
    "dotenv": "^16.3.1",
    "expo": "^49.0.23",
    "expo-asset": "~8.10.1",
    "expo-av": "~13.4.1",
    "expo-cached-image": "49",
    "expo-constants": "~14.4.2",
    "expo-dev-client": "~2.4.13",
    "expo-file-system": "~15.4.5",
    "expo-font": "~11.4.0",
    "expo-linear-gradient": "~12.3.0",
    "expo-linking": "~5.0.2",
    "expo-localization": "~14.3.0",
    "expo-network": "~5.4.0",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "expo-updates": "~0.18.19",
    "expo-web-browser": "~12.3.2",
    "firebase": "^9.22.0",
    "i18next": "^22.4.15",
    "prettier": "^2.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-i18next": "^12.2.2",
    "react-native": "0.72.10",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-shared-element": "0.8.8",
    "react-native-svg": "13.9.0",
    "react-native-touchable-scale": "^2.2.0",
    "react-native-web": "~0.19.6",
    "react-navigation-stack": "^2.10.4",
    "recoil": "^0.5.2",
    "react-native-svg-transformer": "1.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
    "@babel/plugin-proposal-optional-chaining": "^7.21.0",
    "@types/react": "~18.2.14",
    "jest-expo": "~49.0.0",
    "typescript": "^5.1.3"
  },
  "private": true,
  "name": "...",
  "version": "0.0.2"
}
{
  "expo": {
    "name": "myappname",
    "slug": "myappname",
    "description": "... ",
    "version": "0.0.2",
    "orientation": "portrait",
    "icon": "...",
    "scheme": "...",
    "userInterfaceStyle": "automatic",
    "splash": {
      "image": "...",
      "resizeMode": "cover",
      "backgroundColor": "..."
    },
    "platforms": ["ios"],
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": false
    }
  }
}
import { ExpoConfig, ConfigContext } from "expo/config";
import * as dotenv from "dotenv";

type Environment = "development" | "staging" | "production" | "local";

const env: Environment = (process.env.ENV as Environment) || "development";

const dbType: Environment =
  (process.env.DB_TYPE as Environment) || "development";
const dbTypeUpper = dbType.toUpperCase();

if (env === "local") {
  dotenv.config({ path: `.env` });
}

function isDevelopment(env: Environment): boolean {
  return env === "development" || env === "local";
}

function getName(baseName: string): string {
  if (isDevelopment(env) && dbType === "development") {
    return `...-dev`;
  } else if (isDevelopment(env) && dbType === "production") {
    return `...-prod-db`;
  } else if (env === "staging") {
    return `...-staging`;
  } else {
    return baseName;
  }
}

export default ({ config }: ConfigContext): ExpoConfig => ({
  ...config,
  name: getName("..."),
  slug: "...",
  plugins: ["expo-localization", "expo-updates"],
  ios: {
    bundleIdentifier:
      process.env.ENV === "production"
        ? "..."
        : "...-dev",
  },
  extra: {
    firebaseConfig: {
     ...
    },
    eas: {
      projectId: "myId",
    },
  },
  updates: {
    url: "https://u.expo.dev/myId",
    enabled: true,
    checkAutomatically: "ON_LOAD",
  },
  runtimeVersion: { policy: "appVersion" },
});
{
  "cli": {
    "version": ">= 5.9.3"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "env": {
        "ENV": "development",
        "DB_TYPE": "production"
      },
      "channel": "development"
    },
    "preview": {
      "distribution": "internal",
      "ios": {
        "enterpriseProvisioning": "adhoc"
      },
      "env": {
        "DB_TYPE": "production",
        "ENV": "production",
        "NODE_ENV": "production"
      },
      "channel": "preview"
    },
    "production": {
      "node": "18.18.0",
      "env": {
        "DB_TYPE": "production",
        "ENV": "production",
        "NODE_ENV": "production"
      },
      "channel": "production"
    }
  },
  "submit": {
    "production": {}
  }
}

Error output

There is no error, everything seems to work just fine, only issue is that updates are not visible on real iOS device.

Reproducible demo or steps to reproduce from a blank project

Use EAS Update for above configurations with internal distribution preview build and see no updates on the real device.

@dtomaszewski dtomaszewski added the needs review Issue is ready to be reviewed by a maintainer label Nov 21, 2024
@dtomaszewski
Copy link
Author

dtomaszewski commented Nov 21, 2024

Manual Update Check

When I manually check for updates on the device using the following code:

async function checkUpdate() {
  try {
    const update = await Updates.checkForUpdateAsync();

    alert(`Update: ${update.isAvailable}`);
    alert(`Update: ${JSON.stringify(update.manifest)}`);
    alert(`Update: ${JSON.stringify(update)}`);
  } catch (error) {
    // Display an alert if an error occurs when fetching updates.
    alert(`Error fetching latest Expo update: ${error}`);
  }
}

I see that the update is available!

upd

However, after performing several app restartt or running the following code to fetch and apply the update:

if (update.isAvailable) {
  await Updates.fetchUpdateAsync();
  await Updates.reloadAsync();
}

Appliocation is not updated with the new code, even after reloading/restarts this update is still available but never loaded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant