Camron
Camron

Reputation: 753

Amplify Flutter: How to connect to existing GraphQL endpoint

I'm implementing Amplify Flutter and want to connect it to our own custom GraphQL endpoint (i.e. non-AppSync). I am however having trouble getting it to work. The official documentation is not super-clear on this (at least not for those of us who are completely new to Amplify). What I have done:

  1. In pubspec.yaml, I’ve added and installed the amplify_api package.
  2. In main.dart, I’ve updated _configureAmplify() to add the AmplifyAPI() plugin.
  3. In amplifyconfiguration.dart, I have manually added the following snippet:
"api": {
        "plugins": {
            "awsAPIPlugin": {
                "xxxxxAPI": {
                    "endpointType": "GraphQL",
                    "endpoint": "http://xxxxxxxx.eba-fmuh2afu.eu-north-1.elasticbeanstalk.com/query",
                    "region": "[REGION]",
                    "authorizationType": "AMAZON_COGNITO_USER_POOLS"
                }
            }
        }
    }

But I keep getting the error "There is no API configured for this plugin with matching endpoint type." What am I doing wrong? (Note: I presume that I don't have to add any "region" value if I'm pointing to our own custom GraphQL endpoint).

Upvotes: 2

Views: 961

Answers (1)

Nguyễn Huy
Nguyễn Huy

Reputation: 21

I was able to fix this issue by closing the app and uninstalling it, then run again and log in to start fetching API

Upvotes: 2

Related Questions