EAS not performing React Native linking correctly?

Hello,

SDK: 42
EAS CLI: 0.23.0

I am experiencing an issue that occurs when using eas build for iOS but not expo build:ios. The issue specifically is regarding an error message that appears as a result of using AWS Amplify’s Auth module for signing in:

null is not an object (evaluating 'RNAWSCognito.computeModPow')

This error message is known to be caused by a React Native linking issue. So considering that I don’t have this issue if I use expo build:ios why does error happen when using eas build?

I believe this supports autolinking now so you shouldn’t need to do anything special - null is not an object (evaluating RNAWSCognito.computeModPow) · Issue #3682 · aws-amplify/amplify-js · GitHub

You may want to try running this locally with expo run:ios to rule out any EAS issues, and also double-check in the package setup for RNAWSCognito that you’ve done all the proper setup steps

autolinking works exactly the same. what you’re experiencing here is likely that in Expo Go we include this function in the preet runtime, but you don’t actually have the required package installed to link it on eas build. do you have the latest amazon-cognito-identity-js installed? it appears to come from that package

Thank you both for providing such a quick response yesterday.

I did not have amazon-cognito-identity-js in my package.json. After installing it I was able to login using an EAS build. Problem solved!

@notbrent Would you mind elaborating on why this wasn’t an issue using Expo Go or building a standalone app using the Expo CLI? You said Expo includes autolinking in the preet runtime? What does that mean?

Expo Go includes a bunch of native code by default. From what Brent says it sounds like the native parts of amazon-cognito-identity-js are included. expo build uses the same native code that is included with Expo Go.

When you build with EAS Build it does not come with all the extra things from Expo Go that you’re not using. This makes the resulting app smaller and faster to start.

In order for EAS Build to know that you are using some library you need to have it listed as a dependency in package.json.

@wodin Okay I think I understand. Thank you for explaining it to me!

1 Like