Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing an empty vanilla react-native project is broken #550

Open
andraz-at opened this issue Apr 11, 2020 · 3 comments
Open

Initializing an empty vanilla react-native project is broken #550

andraz-at opened this issue Apr 11, 2020 · 3 comments
Labels
appsync-core Related to core updates within AppSync SDK to-be-reproduced We need to reproduce this issue

Comments

@andraz-at
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?

Android build errors out with emulator message:

Error: Cannot use t "_Schema" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

I am following the instructions to initialize a blank react-native project (not expo).

It breaks in emulator after building this step: https://aws-amplify.github.io/docs/js/datastore#import-generated-models

> npm ls graphql

+-- @aws-amplify/datastore@2.0.7
| `-- @aws-amplify/api@3.1.6
|   `-- @aws-amplify/api-graphql@1.0.8
|     `-- graphql@14.0.0  deduped
+-- UNMET PEER DEPENDENCY @aws-amplify/pubsub@3.0.7
| `-- graphql@14.0.0
`-- UNMET PEER DEPENDENCY react-native@0.62.2
  `-- eslint-plugin-relay@1.4.1
    `-- graphql@14.0.0  deduped

npm ERR! peer dep missing: @aws-amplify/pubsub@^2.1.1, required by @aws-amplify/api@3.1.6
npm ERR! peer dep missing: react-native@>=0.60 <0.62, required by react-native-webview@9.1.4

What is the expected behavior?

Normal blank react-native vanilla build running inside Android emulator without errors.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?

> node -v
v13.11.0
> npm -v
6.13.7

Only difference to #487 is that you now get the letter t in the same error message.

@elorzafe elorzafe added the to-be-reproduced We need to reproduce this issue label Apr 15, 2020
@elorzafe
Copy link
Contributor

@andraz-at are you using aws-appsync package or only @aws-amplify/datastore?

@elorzafe elorzafe added the appsync-core Related to core updates within AppSync SDK label Apr 15, 2020
@andraz-at
Copy link
Author

There was a recent change in the documentation how the packages should get used:

import { DataStore, Predicates } from "@aws-amplify/datastore"

which causes the build to break (if not commented out). The previous (older version) way was importing everything from the same aws-amplify package.

For the command line interface, I am using Amplify CLI initialized with:

$ npm install -g @aws-amplify/cli
$ amplify configure

p.s.: Another thing missing in the documentation: you need to run .configure() also on DataStore.configure() to get it to work properly when deployed to AWS. This is for create-react-app build deployed as web app but might apply also to react-native.

import awsconfig from "./aws-exports"
Amplify.configure(awsconfig)
DataStore.configure(awsconfig)

@andraz-at
Copy link
Author

It might be related to #545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appsync-core Related to core updates within AppSync SDK to-be-reproduced We need to reproduce this issue
Projects
None yet
Development

No branches or pull requests

2 participants