amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

How to point amplify v2 at existing aws graphql?

Open cookiejest opened this issue 1 year ago • 2 comments

Amplify CLI Version

12.12.5

Question

I want to point my amplify v2 at a SAM generated app sync graphql URL and for it to use that rather than generating it in the amplify cli black box.

How do I do that?

cookiejest avatar Aug 18 '24 11:08 cookiejest

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂

ykethan avatar Aug 20 '24 18:08 ykethan

Hi @cookiejest, if you need to point your frontend graphql client to your own AppSync graphql endpoint, you just need to configure the Amplify client like so:

import { Amplify } from 'aws-amplify';

Amplify.configure({
  ...Amplify.getConfig(),
  API: {
    GraphQL: {
      endpoint: 'https://my-appsync-endpoint.us-east-1.aws.com',
      defaultAuthMode: 'userPool',
    },
  },
});

For more information on using existing AWS resources, this page may be helpful:

https://docs.amplify.aws/react/build-a-backend/add-aws-services/analytics/existing-resources/#configuring-client-library-directly

chrisbonifacio avatar Aug 20 '24 20:08 chrisbonifacio

Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.

Thank you!

cwomack avatar Oct 22 '24 20:10 cwomack