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 upload successfully, but changes are not applied after making restart now #2681

Open
ahmedelsayed11 opened this issue Nov 11, 2024 · 5 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@ahmedelsayed11
Copy link

Build/Submit details page URL

https://expo.dev/accounts/waseet/projects/waseetnet

Summary

What happens is, I am creating a build using eas build --profile staging --platform ios
And it's successfully created the build and uploaded it to testflight and it runs without any issue.

When i make some edits on my HomeScreen adding a new button and make eas update --branch staging
it create the update successfully but nothing changes when Restart the app to apply the updtes

my app.json is

{
  "name": "WaseetNet",
  "displayName": "WaseetNet",
  "expo": {
    "name": "WaseetNet",
    "slug": "waseetnet",
    "version": "1.0.8",
    "runtimeVersion": "1.0.7",
    "updates": {
      "enabled": true,
      "url": "https://u.expo.dev/PROJECT_ID",
      "checkAutomatically": "ON_LOAD",
      "fallbackToCacheTimeout": 0
    },
    "extra": {
      "eas": {
        "projectId": "PROJECT_ID"
      }
    }
  }
}

My eas.json is:

{
  "cli": {
    "version": ">= 12.6.2",
    "appVersionSource": "remote"
  },
  "build": {
    "production": {
      "autoIncrement": true,
      "channel": "production",
      "env": {
        "ENVFILE": ".env.prod",
        "CI": "true",
        "ENV_VARIABLE": "production"
      },
      "android": {
        "buildType": "app-bundle",
        "gradleCommand": "bundleProductionRelease"
      },
      "ios": {
        "buildConfiguration": "Release",
        "scheme": "Waseet"
      }
    },
    "staging": {
      "autoIncrement": true,
      "channel": "staging",
      "env": {
        "ENVFILE": ".env.staging",
        "CI": "true",
        "ENV_VARIABLE": "staging"
      },
      "android": {
        "buildType": "apk",
        "gradleCommand": "bundleStagingRelease"
      },
      "ios": {
        "buildConfiguration": "Release",
        "scheme": "WaseetStg"
      }
    },
    "development": {
      "autoIncrement": true,
      "channel": "development",
      "env": {
        "ENVFILE": ".env.dev",
        "CI": "true",
        "ENV_VARIABLE": "development"
      },
      "android": {
        "buildType": "apk",
        "gradleCommand": "bundleDevelopmentRelease"
      },
      "ios": {
        "buildConfiguration": "Release",
        "scheme": "WaseetDev"
      }
    }
  },
  "submit": {}
}

My package.json is:

{
  "name": "WaseetNet",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "eas-pre-build": "sh ./copy-expo-plist.sh $ENV_VARIABLE",
    "prepare": "if [ \"$CI\" != \"true\" ]; then husky install; else echo 'Skipping husky in CI'; fi",
    "eas-build-pre-install": "yarn eas-pre-build && yarn install && npx react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "postinstall": "patch-package",
    "build-ios": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle --assets-dest ./ios",
    "prei-pre": "cp .env-pre .env",
    "tsc-lint": "bash automation/type/tsc-lint.sh",
    "type": "tsc --noEmit",
    "aos:dev": "react-native run-android --mode=developmentdebug --appId=com.awi.waseet.development",
    "aos:dev-r": "cd android && ./gradlew assembleDevelopmentRelease",
    "aos:stg": "react-native run-android --mode=stagingdebug --appId=com.awi.waseet.staging",
    "aos:stg-r": "react-native run-android --mode=stagingrelease --appId=com.awi.waseet.staging",
    "aos:stg-apk": "cd android && ./gradlew assembleStagingRelease",
    "aos:prod": "react-native run-android --mode=productiondebug --appId=com.awi.waseet",
    "aos:prod-r": "react-native run-android --mode=productionrelease --appId=com.awi.waseet"
  },
  "dependencies": {
    "@gorhom/bottom-sheet": "^4",
    "@notifee/react-native": "^9.1.2",
    "@react-native-async-storage/async-storage": "^1.23.1",
    "@react-native-community/checkbox": "^0.5.17",
    "@react-native-community/cli-platform-android": "^13.6.9",
    "@react-native-community/datetimepicker": "^8.2.0",
    "@react-native-community/netinfo": "^11.3.2",
    "@react-native-firebase/app": "^21.2.0",
    "@react-native-firebase/messaging": "^21.2.0",
    "@react-navigation/bottom-tabs": "^6.6.0",
    "@react-navigation/material-bottom-tabs": "^6.2.28",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/native-stack": "^6.10.0",
    "@react-navigation/stack": "^6.4.0",
    "@reduxjs/toolkit": "^2.2.6",
    "@shopify/flash-list": "^1.7.1",
    "@types/react-native-vector-icons": "^6.4.18",
    "async-mutex": "^0.5.0",
    "axios": "^1.7.2",
    "base-64": "^1.0.0",
    "crypto-js": "^4.2.0",
    "expo": "^51.0.0",
    "expo-updates": "~0.25.27",
    "formik": "^2.4.6",
    "hermes-engine": "^0.11.0",
    "i18next": "^23.11.5",
    "libphonenumber-js": "^1.11.4",
    "lodash": "^4.17.21",
    "lottie-ios": "^4.5.0",
    "lottie-react-native": "^7.0.0",
    "patch-package": "^8.0.0",
    "react": "18.2.0",
    "react-i18next": "^14.1.2",
    "react-native": "0.74.1",
    "react-native-actions-sheet": "^0.9.7",
    "react-native-background-timer": "^2.4.1",
    "react-native-collapsible": "^1.6.2",
    "react-native-config": "^1.5.3",
    "react-native-device-info": "^11.1.0",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-fast-image": "^8.6.3",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "^2.16.2",
    "react-native-image-picker": "^7.1.2",
    "react-native-inappbrowser-reborn": "^3.7.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-keychain": "^8.2.0",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-maps": "^1.18.0",
    "react-native-modal-datetime-picker": "^18.0.0",
    "react-native-moengage": "10.1.0",
    "react-native-pager-view": "^6.4.1",
    "react-native-paper": "^5.12.3",
    "react-native-permissions": "^4.1.5",
    "react-native-reanimated": "^3.16.1",
    "react-native-reanimated-carousel": "4.0.0-canary.17",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "^4.10.8",
    "react-native-screens": "^3.32.0",
    "react-native-share": "^11.0.3",
    "react-native-size-matters": "^0.4.2",
    "react-native-svg": "^15.3.0",
    "react-native-svg-transformer": "^1.4.0",
    "react-native-svg-uri": "^1.2.3",
    "react-native-tab-view": "^3.5.2",
    "react-native-toast-message": "^2.2.0",
    "react-native-vector-icons": "^10.1.0",
    "react-native-video": "^6.4.4",
    "react-native-webview": "^13.10.5",
    "react-navigation": "^5.0.0",
    "react-redux": "^9.1.2",
    "reactotron-react-native": "^5.1.7",
    "recyclerlistview": "^4.2.1",
    "redux": "^5.0.1",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^3.1.0",
    "rn-crypto-js": "^1.1.2",
    "yup": "^1.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.24.7",
    "@babel/plugin-transform-private-methods": "^7.24.7",
    "@babel/preset-env": "^7.24.7",
    "@babel/preset-react": "^7.24.7",
    "@babel/preset-typescript": "^7.24.7",
    "@babel/runtime": "^7.20.0",
    "@react-native-community/cli": "^15.1.1",
    "@react-native-community/eslint-config": "^3.2.0",
    "@react-native/babel-preset": "0.74.83",
    "@react-native/eslint-config": "0.74.83",
    "@react-native/metro-config": "0.74.83",
    "@react-native/typescript-config": "0.74.83",
    "@tsconfig/react-native": "^3.0.5",
    "@types/base-64": "^1.0.2",
    "@types/crypto-js": "^4.2.2",
    "@types/eslint": "^9",
    "@types/jest": "^29.5.12",
    "@types/lodash": "^4",
    "@types/react": "^18.3.3",
    "@types/react-native": "^0.64.12",
    "@types/react-test-renderer": "^18.3.0",
    "babel-jest": "^29.6.3",
    "babel-plugin-module-resolver": "^5.0.2",
    "dpdm": "^3.14.0",
    "eslint": "^8.19.0",
    "eslint-import-resolver-typescript": "^3.6.1",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-jest": "^28.8.0",
    "eslint-plugin-sonarjs": "^0.25.1",
    "eslint-plugin-testing-library": "^6.2.2",
    "eslint-plugin-unused-imports": "^3.2.0",
    "husky": "^8.0.0",
    "jest": "^29.6.3",
    "lint-staged": "^15.2.2",
    "metro-react-native-babel-preset": "^0.77.0",
    "prettier": "2.8.8",
    "react-native-dotenv": "^3.4.11",
    "react-test-renderer": "18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  },
  "husky": {
    "hooks": {
      "commit-msg": "sh .husky/commit-msg",
      "pre-commit": "sh .husky/pre-commit"
    }
  },
  "lint-staged": {
    "*.{ts,tsx}": [
      "yarn run prettier --write",
      "yarn run lint --fix",
      "yarn run tsc-lint"
    ]
  }
}

Managed or bare?

bare app

Environment

Warning: Root-level "expo" object found. Ignoring extra keys in Expo config: "name", "displayName"
Learn more: https://expo.fyi/root-expo-object
✔ Check package.json for common issues
✔ Check Expo config for common issues
✔ Check for common project setup issues
✖ Check dependencies for packages that should not be installed directly
✔ Check for issues with Metro config
✔ Check if the project meets version requirements for submission to app stores
✖ Check for app config fields that may not be synced in a non-CNG project
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check npm/ yarn versions
✖ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check native tooling versions

Detailed check results:

The package  "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.

This project contains native project folders but also has native configuration properties in app.json, indicating it is configured to use Prebuild. When the android/ios folders are present, EAS Build will not sync the following properties: updates.

Advice: Add '/android' and '/ios' to your .gitignore file if you intend to use CNG / Prebuild. Learn more.

Warning: Root-level "expo" object found. Ignoring extra keys in Expo config: "name", "displayName"
Learn more: https://expo.fyi/root-expo-object
The following packages should be updated for best compatibility with the installed expo version:
  @react-native-async-storage/[email protected] - expected version: 1.23.1
  @react-native-community/[email protected] - expected version: 8.0.1
  @react-native-community/[email protected] - expected version: 11.3.1
  @shopify/[email protected] - expected version: 1.6.4
  [email protected] - expected version: 6.7.0
  [email protected] - expected version: 0.74.5
  [email protected] - expected version: ~2.16.1
  [email protected] - expected version: 1.14.0
  [email protected] - expected version: 6.3.0
  [email protected] - expected version: ~3.10.1
  [email protected] - expected version: 4.10.5
  [email protected] - expected version: 3.31.1
  [email protected] - expected version: 15.2.0
  [email protected] - expected version: 13.8.6
  @types/[email protected] - expected version: ~18.2.79
  [email protected] - expected version: ~5.3.3
Your project may not work correctly until you install the expected versions of the packages.
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

One or more checks failed, indicating possible issues with the project.

Error output

No response

Reproducible demo or steps to reproduce from a blank project

Create a new fresh react native app with versions:
"react-native": "0.74.1", "react": "18.2.0", "expo": "^51.0.0", "expo-updates": "~0.25.27",

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

My code to check updates is:

  const checkForUpdates = async () => {
    if (__DEV__) {
      // Skip the update check in development
      return;
    }

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

      alert('🚀 ~ checkForUpdates ~ update:', update);
      if (update.isAvailable) {
        await Updates.fetchUpdateAsync();

        Alert.alert(
          'Update Available',
          'An update has been downloaded and will be applied on restart.',
          [
            {
              text: 'Restart Now',
              onPress: async () => await Updates.reloadAsync(),
            },
          ],
        );
      }
      // To do make update
    } catch (e) {
      alert('🚀 ~ checkForUpdates ~ e:', JSON.stringify(e));
      console.error('Error checking for updates:', e);
    }
  };

@ahmedelsayed11
Copy link
Author

@szdziedzic

@fatihkayan20
Copy link

Facing same issue. It crashes once and then when I open app it reloads successfully but it doesn't apply changes. It does same thing every time when I open app.

@fatihkayan20
Copy link

Solved my problem with renaming my env variables file from .env.local to .env 🙃

@ahmedelsayed11
Copy link
Author

Solved my problem with renaming my env variables file from .env.local to .env 🙃

i don't know how this solved your problem but i am using react-native-config because i have multi enviroment setup and multi schema and flavours how i will rename it !!

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

2 participants