Problem fetching data with android in SDK48

Please provide the following:

  1. SDK Version: 48.0.5
  2. Platforms(Android/iOS/web/all): problem only on android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Since I upgrade from SDK47 to SDK48, The android version have a problem fetching data.

Here is the error message apiClient.addAsyncRequestTransform ~ error [TypeError: undefined is not a function]
It is like apisauce/axios don’t send auth token in header. Only sometimes.

Here is my packages :

  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios"
  },
  "dependencies": {
    "@bugsnag/expo": "^48.0.0",
    "@bugsnag/plugin-expo-eas-sourcemaps": "^47.1.0",
    "@bugsnag/source-maps": "^2.3.1",
    "@expo-google-fonts/poppins": "^0.2.2",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/hooks": "^2.8.1",
    "@react-native-community/netinfo": "9.3.7",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.5.2",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/stack": "^6.3.10",
    "apisauce": "^3.0.0",
    "debounce": "^1.2.1",
    "expo": "^48.0.6",
    "expo-application": "~5.1.1",
    "expo-blur": "~12.2.2",
    "expo-camera": "~13.2.1",
    "expo-constants": "~14.2.1",
    "expo-crypto": "~12.2.1",
    "expo-dev-client": "~2.1.5",
    "expo-device": "~5.2.1",
    "expo-file-system": "~15.2.2",
    "expo-font": "~11.1.1",
    "expo-image-picker": "~14.1.1",
    "expo-intent-launcher": "~10.5.2",
    "expo-location": "~15.1.1",
    "expo-notifications": "~0.18.1",
    "expo-secure-store": "~12.1.1",
    "expo-splash-screen": "~0.18.1",
    "expo-status-bar": "~1.4.4",
    "expo-task-manager": "~11.1.1",
    "expo-updates": "~0.16.3",
    "formik": "^2.2.9",
    "lottie-react-native": "5.1.4",
    "moment": "^2.29.4",
    "number-to-locale-string-polyfill": "^1.0.9",
    "react": "18.2.0",
    "react-native": "0.71.3",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-maps": "1.3.2",
    "react-native-progress": "^5.0.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-svg": "13.4.0",
    "react-native-uuid": "^2.0.1",
    "uuid": "^9.0.0",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

Hi @jclepin

Please post a small example of how you’re using apiClient.addAsyncRequestTransform()?

Hi wodin, here is the implementation. Error comes from the catch

const apiClient = create({
  baseURL: "https://xxx",
});

apiClient.addAsyncRequestTransform(async (request) => {
  try {
    const uniqId = await useUniqId();
    const authToken = await authStorage.getToken();
    request.headers["Authorization"] = `Bearer ${authToken}`;
    request.headers["DeviceId"] = uniqId;
    request.headers["UserAgent"] = Device.osName + " " + Device.osVersion;
  } catch (error) {
    logger.log(
      "🚀 ~ file: client.js:26 ~ apiClient.addAsyncRequestTransform ~ error",
      error
    );
  }
});

export default apiClient;

Wouldn’t expect that but The probleme comes from uuid lib.

I use the uuidv4() that don’t appear to work with SDK48 in android (but with SDK47)

I switch to react-native-uuid and the error is gone

Thank you very much Wodin for your help

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.