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:
- In my IDE the import is flagged with
S7016: Could not find a declaration file for module 'aws-amplify-react-native'.
- Bundling as part of
expo start --dev-client
fails withLogs 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.
- 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
- by ignoring the warning,
-
by adding
to theresolver: { blacklistRE: /#current-cloud-backend\/.*/ }
module.exports
inmetro-config.js
, and -
by adding
to the configuration I supply toAnalytics: { disabled: true }
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?