Closed dpilch closed 2 years ago
Canceling this change. Please use ApolloLink
exported from @apollo/client
and there shouldn't be an issue.
import React from "react";
import { registerRootComponent } from "expo";
import Amplify from "aws-amplify";
import AppSyncConfig from "./src/aws-exports";
import { createAuthLink } from "aws-appsync-auth-link";
import { createSubscriptionHandshakeLink } from "aws-appsync-subscription-link";
import {
ApolloLink,
ApolloClient,
ApolloProvider,
InMemoryCache,
} from "@apollo/client";
import App from "./App";
Amplify.configure(AppSyncConfig);
const url = AppSyncConfig.aws_appsync_graphqlEndpoint;
const region = AppSyncConfig.aws_appsync_region;
const auth = {
type: AppSyncConfig.aws_appsync_authenticationType,
apiKey: AppSyncConfig.aws_appsync_apiKey,
};
const link = ApolloLink.from([
createAuthLink({ url, region, auth }),
createSubscriptionHandshakeLink({ url, region, auth }),
]);
const client = new ApolloClient({
link,
cache: new InMemoryCache(),
});
const WithProvider = () => (
<ApolloProvider client={client}>
<App />
</ApolloProvider>
);
export default registerRootComponent(WithProvider);
Canceling this change. Please use
ApolloLink
exported from@apollo/client
and there shouldn't be an issue.import React from "react"; import { registerRootComponent } from "expo"; import Amplify from "aws-amplify"; import AppSyncConfig from "./src/aws-exports"; import { createAuthLink } from "aws-appsync-auth-link"; import { createSubscriptionHandshakeLink } from "aws-appsync-subscription-link"; import { ApolloLink, ApolloClient, ApolloProvider, InMemoryCache, } from "@apollo/client"; import App from "./App"; export default registerRootComponent(WithProvider);
@dpilch This doesn't fix problems with Angular Apollo. @apollo/client has a dependency on React whereas @apollo/client/core does not. There is a whole thread about @apollo/client vs @apollo/client/core over at the Apollo repo: https://github.com/apollographql/apollo-client/issues/7318
The original fix in #566 of changing it to Observable
I'm also adding my name to others on #713 that ZenObservable is also failing to build in Angular projects.
Description of changes: Continuing change from https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/566. This change was originally created by a contributor but it appears to have been abandoned. See https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/566 for full description.
See v2 change: https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/728
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.