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

Crash app on android caused by 'Can't find variable: BigInt' #725

Open
quocbinhof97 opened this issue Oct 4, 2024 · 5 comments
Open

Crash app on android caused by 'Can't find variable: BigInt' #725

quocbinhof97 opened this issue Oct 4, 2024 · 5 comments
Labels

Comments

@quocbinhof97
Copy link

quocbinhof97 commented Oct 4, 2024

Stack trace

Android build is crash when setting config.firstPartyHosts = ['example.com'];, but it work well on IOS.

In my gradle.properties

newArchEnabled=false
hermesEnabled=false

If I enable hermesEnabled=true it works fine, but I want to use the JS engine. Can anyone help me about it.

Image

Reproduction steps

Run android build via react-native run-android

Volume

100%

Affected SDK versions

2.4.3

Latest working SDK version

2.4.3

Does the crash manifest in the latest SDK version?

Yes

React Native Version

0.74.3

Package.json Contents

No response

iOS Setup

No response

Android Setup

android/app/build.gradle

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}

Device Information

No response

Other relevant information

No response

@marco-saia-datadog
Copy link
Member

Hello @quocbinhof97 👋

Thank you for reaching out!

Could you please share your package.json?

@quocbinhof97
Copy link
Author

Hello @marco-saia-datadog, Thank you for your attention. Here is my package.json

{
"name": "example",
"version": "0.0.1",
"private": true,
"dependencies": {
"@datadog/mobile-react-native": "^2.4.3",
"@datadog/mobile-react-navigation": "^2.4.3",
"@react-navigation/bottom-tabs": "^6.6.0",
"@react-navigation/material-top-tabs": "^6.6.13",
"@react-navigation/native": "^6.1.18",
"@react-navigation/stack": "^6.4.0",
"axios": "^1.7.2",
"react": "18.2.0",
"react-native": "0.74.3",
"react-native-config": "^1.5.2",
"react-native-fs": "^2.20.0",
"react-native-safe-area-context": "^4.10.8",
"react-native-screens": "^3.32.0",
"rxjs": "^7.8.1",
"uuid": "^10.0.0",
"yup": "^1.4.0",
.............
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.85",
"@react-native/eslint-config": "0.74.85",
"@react-native/metro-config": "0.74.85",
"@react-native/typescript-config": "0.74.85",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"@types/uuid": "^10.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"jest": {
"preset": "react-native"
},
"engines": {
"node": ">=18"
},
}

@quocbinhof97
Copy link
Author

The following details may be helpful:

  • Error occurs only when making any api call by axios, for example:
constructor() {
    this.axiosInstance = axios.create(HttpConfig);
    this.axiosInstance.interceptors.response.use(
      responseInterceptor,
      errorInterceptor,
    );
}

async httpGet<T>(
    url: string, 
    config?: AxiosRequestConfig | undefined,
): Promise<AxiosResponse<T>> {
    return this.axiosInstance.get<T>(url, config); //An error occurred when this line was called
}
  • Logs from AxiosError, I have this information:
export const errorInterceptor = (error: AxiosError) => {
    const { response, request } = error;
    console.log('request', error); //[TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[1], "./TracingIdentifier").TracingIdentifier')]
    console.log('response', response); //undefined
};

@marco-saia-datadog
Copy link
Member

Hello @quocbinhof97 👋

We will work on an official solution for this problem.

I would suggest you to look at this comment: #733 (comment)

It describes a temporary workaround that you can use while waiting for the release that contains the fix.

Would that work for you?

@quocbinhof97
Copy link
Author

Hello @marco-saia-datadog
Thanks for answer, I tried to fix the error according to suggestion #733 (comment)

Now, it doesn't show the error screen but there is a line in the console.
[Error: Invalid integer: NaN is not a valid exponent.]
And every call using axios still breaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants