Reputation: 369
I am using the amplify cli with my NextJs app. I feel like maybe I configured something wrong Im getting this error when trying to query data:
[WARN] 32:17.454 DataStore - Data won't be synchronized. No GraphQL endpoint configured. Did you forget Amplify.configure(awsconfig)
?
But I do have an aws-exports.js file. BUT i do see it sais awsmobile , im not to sure what else I might be doing wrong.
aws-exports file:
const awsmobile = {
aws_project_region: 'us-east-2',
aws_appsync_graphqlEndpoint:
private,
aws_appsync_region: 'us-east-2',
aws_appsync_authenticationType: 'API_KEY',
aws_appsync_apiKey:private,
}
Upvotes: 1
Views: 6243
Reputation: 81
As the warning suggests, you may want to check if Amplify.configure(awsconfig)
is called to set up the library in your project.
For example, this is the example given in the official documentation.
// pages/index.js
import { AmplifyAuthenticator } from "@aws-amplify/ui-react";
import { Amplify, API, Auth, withSSRContext } from "aws-amplify";
import Head from "next/head";
import awsExports from "../src/aws-exports";
import { createPost } from "../src/graphql/mutations";
import { listPosts } from "../src/graphql/queries";
import styles from "../styles/Home.module.css";
Amplify.configure({ ...awsExports, ssr: true });
In your case, you may import awsmobile
from aws-exports.js
and call Amplify.configure({...awsmobile, ssr: true});
in your app's entry point.
Upvotes: 3