js-sdks icon indicating copy to clipboard operation
js-sdks copied to clipboard

Expo: Unable to resolve "class-validator"

Open ajaffie opened this issue 1 year ago • 8 comments

Sometime after version 1.14, something changed that broke the package. I get this error during bundling:

Unable to resolve "class-validator" from "node_modules\@devcycle\react-native-expo-client-sdk\node_modules\@devcycle\types\index.cjs.js"

If I downgrade to 1.14, I no longer get the error. I'm using Expo SDK 50.

ajaffie avatar May 14 '24 13:05 ajaffie

Hey @ajaffie, thanks for raising this issue. Let us investigate and we'll get back to you shortly!

kaushalkapasi avatar May 14 '24 16:05 kaushalkapasi

Hey @ajaffie, could you provide some more information:

  • Expo: SDK 50
  • Node version?
  • Are you using NPM / Yarn?
    • version of NPM / Yarn
    • are there any specific configurations (pnpm mode, linker)

kaushalkapasi avatar May 16 '24 15:05 kaushalkapasi

@kaushalkapasi Sure!

  • Node version: 18.18.2
  • Using NPM 9.8.1
  • No special configurations.

ajaffie avatar May 16 '24 16:05 ajaffie

Hey @ajaffie we've published a newer version of the React-Native-Expo-Client-SDK (1.17.0)

"@devcycle/react-native-expo-client-sdk": "^1.17.0",

Could you try running npx expo install @devcycle/[email protected] and let me know if this issue persists?

Thanks!

kaushalkapasi avatar May 16 '24 18:05 kaushalkapasi

@kaushalkapasi It bundles now, but the app just shows a black screen (on iOS). If I set logLevel in the options passed to withDevCycleProvider to debug, nothing is output.

Actually on the Android simulator, it says "There was a problem loading the project" and "Maximum call stack size exceeded".

My root _layout, which I wrap with withDevCycleProvider, is not rendered (checked with console.log).

ajaffie avatar May 16 '24 20:05 ajaffie

Hm interesting, would it be possible for you to share a minimum reproduction so I can investigate this further?

kaushalkapasi avatar May 16 '24 20:05 kaushalkapasi

@kaushalkapasi Here you go: https://github.com/ajaffie/devcycle-855-repro

There is one difference, in this repro the app isn't hanging or crashing. It does log the call stack exceeded error several times, though:

 DEBUG  root layout {"devCycleInit": false}
 ERROR  Unhandled promise rejection [RangeError: Maximum call stack size exceeded (native stack depth)]
 DEBUG  root layout {"devCycleInit": true}
 ERROR  Unhandled promise rejection [RangeError: Maximum call stack size exceeded]
 DEBUG  root layout {"devCycleInit": true}
 ERROR  Unhandled promise rejection [RangeError: Maximum call stack size exceeded]
 ERROR  Unhandled promise rejection [RangeError: Maximum call stack size exceeded]
 ERROR  Unhandled promise rejection [TypeError: Object is not a constructor]
 ERROR  Unhandled promise rejection [RangeError: Maximum call stack size exceeded]

You should just need to add an SDK key in src/app/_layout.tsx, npm install, npx expo prebuild --platform android, npm run android

ajaffie avatar May 17 '24 17:05 ajaffie

@ajaffie thanks! I'll take a look and let you know my findings.

As an aside, we've also added a dedicated page with some React-Native Expo docs here. If you have any feedback / suggestions, we'd be happy to make the changes accordingly!

kaushalkapasi avatar May 17 '24 17:05 kaushalkapasi

Hi @ajaffie we released version 2.0.0 of our React Native and React Native Expo SDKs which should contain a fix for the issues that you're seeing here. Could you give that a try and let us know if that resolves your issue?

leslie-lau avatar May 30 '24 14:05 leslie-lau

HI @ajaffie have you had a chance to take a look at our update and does that fix the issue you were seeing?

leslie-lau avatar Jun 10 '24 18:06 leslie-lau

@leslie-lau Sorry I was working on other things. Just gave it a shot and it seems to be fixed. I will let you know if it ends up actually not working. Thanks!

ajaffie avatar Jun 10 '24 20:06 ajaffie

Hi @ajaffie just wanted to follow up to see if everything's working as expected! How's the fix looking?

leslie-lau avatar Aug 07 '24 18:08 leslie-lau

Haven't noticed any issues, I think it's good!

ajaffie avatar Aug 07 '24 18:08 ajaffie