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.

eas update missing --clear-cache option

See original GitHub issue

Build/Submit details page URL

https://expo.dev/accounts/kavyar-org/projects/kavyar-app/updates/d58a32ad-7c5a-4122-8def-29c85401bb7d

Summary

eas update seems to be missing a --clear-cache option. expo publish had this option and eas build has it. Not having it is causing problems with our app updates.

We are using a STAGE environment variable to auto-configure our app for the appropriate release environment (dev, staging, production). We inject it into the app using eas.json, app.config.js, and the Constants.manifest2?.extra?.expoClient?.extra?.eas?.STAGE technique recommended in the docs.

This works fine for the initial EAS build. However, when we do eas update, the generated bundle will often have a stale value (from a prior build) for the STAGE var that gets injected via Constants.

We used to use the --clear option with expo publish to work around this, but that option is not available for eas update.

This recently caused a staging config to be released into our production app, which created quite a mess.

Managed or bare?

Managed

Environment

  expo-env-info 1.0.3 environment info:
    System:
      OS: macOS 12.2.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
      Yarn: 1.22.18 - /opt/homebrew/bin/yarn
      npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
      Android SDK:
        API Levels: 31
        Build Tools: 31.0.0, 32.0.0
        System Images: android-31 | Google APIs ARM 64 v8a
    IDEs:
      Android Studio: 2020.3 AI-203.7717.56.2031.7784292
      Xcode: 13.4/13F17a - /usr/bin/xcodebuild
    npmPackages:
      babel-preset-expo: ~9.1.0 => 9.1.0 
      expo: ^45.0.0 => 45.0.4 
      react: 17.0.2 => 17.0.2 
      react-dom: 17.0.2 => 17.0.2 
      react-native: 0.68.2 => 0.68.2 
      react-native-web: 0.17.7 => 0.17.7 
    npmGlobalPackages:
      eas-cli: 0.52.0
      expo-cli: 5.4.7
    Expo Workflow: managed

Error output

No response

Reproducible demo or steps to reproduce from a blank project

Hopefully the issue is clear enough not to need an isolated reproduction. If a reproduction is required, let me know and I will see if our team has time to create one.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
kbrandwijkcommented, Aug 21, 2022

You are right that such an option doesn’t exist yet, and that this will cause issues when only environment variables are updated, making the bundler think nothing has changed. We are looking into the best solution for this internally, but in the meantime, there is a workaround.

You can run expo export --experimental-bundle --clear-cache, which will force the dist folder to be updated. After that, running eas update as normal will use the updated bundle for the update.

Update: as pointed out below, it’s expo export --experimental-bundle --clear

1reaction
SleeplessBytecommented, Sep 13, 2022

I also ran into this (this is still tagged as need review) and it has actually broken our production envs a few times as well as leaking development and test values into production apps.

Even if you log in app.config.ts env-provided values, the dist folder will have still the old data. Even purging the dist folder before building still generated the old data, meaning that (likely) the bundler holds some transform cache somewhere, probably relating to babel.

expo export --experimental-bundle --clear

whilst this seems to maybe work consistently, doesn’t this force an extra build? Or will the eas update afterwards just pick up that build instead?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clear cache to fix problems with your games - EA Help
Games won't download or update? Learn how to clear cache for the EA app, Origin, PlayStation, Xbox, and Nintendo Switch.
Read more >
Caching dependencies - Expo Documentation
The cache field on build profiles in eas.json can be used to configure caching for specific files and directories. Specified files will be...
Read more >
How can I clean (reset cache) of React Native using Expo. Not ...
expo r -c. According to this forum post from an Expo dev, that's the command to start it cache clean. EDIT: They have...
Read more >
Automatically substitute font for missing East Asian characters
Checks/Unchecks the corresponding UI option. Supported on: At least Windows 7. Registry Hive, HKEY_CURRENT_USER. Registry Path, software\policies\microsoft\ ...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Updated user-agent overrides to match options in Safari 16 (251881@main) ... Fixed missing lineNumber and columnNumber in inline violation reports (r285800) ...
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