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

Update dotenv-expand to fix critical error in SDK50 #27755

Closed
daniel-xyz opened this issue Mar 19, 2024 · 1 comment · Fixed by #27764
Closed

Update dotenv-expand to fix critical error in SDK50 #27755

daniel-xyz opened this issue Mar 19, 2024 · 1 comment · Fixed by #27764
Assignees
Labels
CLI Versioned Expo CLI -- `npx expo start` outdated

Comments

@daniel-xyz
Copy link

daniel-xyz commented Mar 19, 2024

Summary

Me and another discord user experienced issues when we updated to SDK 50 or started a new project with SDK 50. npx commands like npx expo start or npx expo install --fix throw JavaScript heap out of memory errors. After manually increasing the heap size the following error appears:

RangeError: Maximum call stack size exceeded
    at RegExpStringIterator.next (<anonymous>)
    at Function.from (<anonymous>)
    at _searchLast (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:5:25)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:12:40)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:38:12)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:38:12)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:38:12)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:38:12)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:38:12)
    at _interpolate (/Volumes/git/myapp/node_modules/dotenv-expand/lib/main.js:38:12)

We could find a workaround by overriding a dependency in the package.json:

  "overrides": {
    "@expo/env": {
      "dotenv-expand": "11.0.6"
    }
  },

It might be related to this issue but since it happens to a newly created SDK 50 project without any .env variables it's hard to say - maybe expo sets some default variables internally. Anyway, it seems to be fixed with a simple version bump.

What platform(s) does this occur on?

No response

SDK Version

50

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.0
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
npm: 10.5.0 - ~/.nvm/versions/node/v20.11.1/bin/npm
Watchman: 2023.10.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ~50.0.13 => 50.0.13
react: 18.2.0 => 18.2.0
react-native: 0.73.5 => 0.73.5
Expo Workflow: managed

Minimal reproducible example

  1. Create new app: npx create-expo-app --template
  2. Select "Blank" project in the CLI
  3. Run npx expo start
@daniel-xyz daniel-xyz added CLI Versioned Expo CLI -- `npx expo start` needs validation Issue needs to be validated labels Mar 19, 2024
@expo-bot expo-bot removed the needs validation Issue needs to be validated label Mar 19, 2024
@daniel-xyz daniel-xyz changed the title Update dotenv-expand to fix error in SDK50 Update dotenv-expand to fix critical error in SDK50 Mar 19, 2024
@byCedric byCedric self-assigned this Mar 20, 2024
byCedric added a commit that referenced this issue Mar 21, 2024
# Why

Fixes #27755

# How

- Added test for recursive expansion (`TEST_EXPAND=${TEST_EXPAND}`)
- Upgraded to `dotenv-expand@11.0.6` to resolve recursive expansion loop

# Test Plan

See added test

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@byCedric
Copy link
Member

byCedric commented Mar 21, 2024

We just merged the fix (upgrading dotenv-expand), still need to backport it to SDK 50 though so bear with us 😄

At least this is fixed now for SDK 51+.


Edit: backported to SDK 50 in 7eb2985

byCedric added a commit that referenced this issue Mar 21, 2024
Fixes #27755

- Added test for recursive expansion (`TEST_EXPAND=${TEST_EXPAND}`)
- Upgraded to `dotenv-expand@11.0.6` to resolve recursive expansion loop

See added test

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLI Versioned Expo CLI -- `npx expo start` outdated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants