Gotchas (and missing documentation) for using AWS Amplify with EAS Build

Starting with a working Expo app (using DataStore), and following the simple steps outlined in the AWS documentation, to add Authentication with

amplify add auth
amplify push

and the basic boilerplate of

import { withAuthenticator } from 'aws-amplify-react-native'

I get a “variety pack” of errors suddenly:

  1. In my IDE the import is flagged with
    S7016: Could not find a declaration file for module 'aws-amplify-react-native'.
    
  2. Bundling as part of expo start --dev-client fails with
    Logs for your project will appear below. Press Ctrl+C to exit.
    jest-haste-map: Haste module naming collision: learning600433b2PostConfirmation
      The following files share their name; please adjust your hasteImpl:
        * <rootDir>/amplify/#current-cloud-backend/function/learning600433b2PostConfirmation/src/package.json
        * <rootDir>/amplify/backend/function/learning600433b2PostConfirmation/src/package.json
    
    Failed to construct transformer:  DuplicateError: Duplicated files or mocks. Please check the console for more info
    ...
    Error: Duplicated files or mocks. Please check the console for more info
    ...
    ⠋ Stopping ...
    RuntimeError: abort(Error: Duplicated files or mocks. Please check the console for more info). Build with -s ASSERTIONS=1 for more info.
    
  3. And once that’s fixed (see below) I every time I run with expo start --dev-client I get:
    [Unhandled promise rejection: Error: No credentials, applicationId or region]
    at node_modules/@aws-amplify/analytics/lib-esm/Providers/AWSPinpointProvider.js:176:66 in __generator$argument_1
    at node_modules/@aws-sdk/client-pinpoint/node_modules/tslib/tslib.js:144:21 in step
    at node_modules/@aws-sdk/client-pinpoint/node_modules/tslib/tslib.js:125:60 in <anonymous>
    at node_modules/@aws-sdk/client-pinpoint/node_modules/tslib/tslib.js:115:51 in fulfilled
    

I can fix

  1. by ignoring the warning,
  2. by adding
    resolver: { blacklistRE: /#current-cloud-backend\/.*/ }
    
    to the module.exports in metro-config.js, and
  3. by adding
    Analytics: { disabled: true }
    
    to the configuration I supply to Amplify.configure when I start my app.

My question is: How was I supposed to know all this? Where is it documented? What other undocumented (and time consuming) surprises lurk in the murky swamps of AWS Amplify —

OK, that’s more of a rant than a question, sorry.

My question is: Where is the documentation for using AWS Amplify with Expo? Is there a single document I’m missing that describes these (and other) required steps?

Hey, do you by chance have like a repo or something like that where you used Expo’s EAS and Amplify DataStore? I’ve been trying to get it running with EAS Build but nothing has worked so far. Amplify functions normally when I use expo start or expo build, but when I want to use the EAS Build it just stops working. I tried catching any exceptions or logging what happens during .then or .catch after calling DataStore.query() or any of the other functions, but nothing is being logged when I run the APK on my device.
The main reason why I’m using Amplify is because it’s the only library/service that I found which provides offline capabilites out of the box in Expo. Other solutions like Firebase or Mongodb Realm don’t even seem to work. My only alternative if this doesn’t work would be to add some sort of manual syncing between a local and a cloud db.