Closed fadur closed 6 years ago
Hi @fadur -
This error message is returned when Amplify's API module doesn't receive the data from your aws-exports file... in otherwords, when the API functionality is called before Amplify.configure is successfully called.
Are you positive that 'call' is only being invoked AFTER Amplify.configure?
Yes, I believe so, same error.
import React from 'react';
import Amplify, { API, graphqlOperation } from 'aws-amplify';
import awsmobile from './aws-exports';
Amplify.Logger.LOG_LEVEL = 'DEBUG';
Amplify.configure(awsmobile);
const Programs = () => {
const getAll = `query getAll{
listPrograms{
items {
id, title, description
}
}
}`;
const data = API.graphql(graphqlOperation(getAll));
console.log(data);
return <div />;
};
export default Programs;
Hi @fadur
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_appsync_graphqlEndpoint": "https://***.appsync-api.eu-west-1.amazonaws.com/graphql",
"aws_appsync_region": "eu-west-1",
"aws_appsync_authenticationType": "API_KEY",
"aws_appsync_apiKey": "da2-***"
};
You are missing the export piece,aws-exports.js
should be like this
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_appsync_graphqlEndpoint": "https://***.appsync-api.eu-west-1.amazonaws.com/graphql",
"aws_appsync_region": "eu-west-1",
"aws_appsync_authenticationType": "API_KEY",
"aws_appsync_apiKey": "da2-***"
};
export default awsmobile;
@elorzafe it's there. I just didn't paste it ,sorry. Edited.
I've also tried configuring it manually.
I've got it to work when i tried using modular imports. So this works, as opposed to the examples in the doc.
import API, { graphqlOperation } from '@aws-amplify/api';
import awsmobile from './aws-exports';
API.configure(awsmobile);
@fadur - Glad to hear that you got it working. I'm leaving this issue open since I think it demands further investigation.
I also encountered this problem. But it is resolved using this temporary code:
API.configure(awsmobile);
Thank @fadur
Just dealt with this same error. Uninstalled then reinstalled the aws-amplify npm package. Everything went back to normal and worked again.
Yeah, it works also in Angular 7+ using the API.configure(amplify)
.
A bit confusing because the docs tell you to use Amplify.configure(amplify);
which I would assume would configure any child app under Amplify?
I'm trying to use the API.graphql
as replacement for my existing CRUD data service and I'm getting the same error, and unfortunately the solution proposed by @knuula didn't work for me, also the when I tried to put the configuration as suggested by @mattiLeBlanc API.configure(config)
I'm getting the following error No userPool
. Any hints about how to debug aws-amplify
bootstrapping to catch this problem ?
Without knowing any of your details: Did you run the amplify cli configuration steps creating you IAM user. And then did you add AUTH using amplify add auth? User pool would only be used for cognito, if I am correct.
On Thu, 20 Jun 2019 at 07:39, Adrian Hernandez-Mendez < notifications@github.com> wrote:
I'm trying to use the API.graphql as replacement for my existing CRUD data service and I'm getting the same error, and unfortunately the solution proposed by @knuula https://github.com/knuula didn't work for me, also the when I tried to put the configuration as suggested by @mattiLeBlanc https://github.com/mattiLeBlanc API.configure(config) I'm getting the following error No userPool. Any hints about how to debug aws-amplify bootstrapping to catch this problem ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/1571?email_source=notifications&email_token=ABIKJK32TIB3U5TFYJ46JIDP3KRQPA5CNFSM4FTERFNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYDLPQA#issuecomment-503756736, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIKJK7N64G3JXJ5YKWONQ3P3KRQPANCNFSM4FTERFNA .
Thanks for your comment and hints @mattiLeBlanc, I'm running a simple React project with CRUD operations with Entity type. I did a version working with hooks https://github.com/adrianhdezm/spa-boilerplate/tree/3.0.0, but when I've tried to migrate to Redux and using the API.graphql
in the context of Redux Observable, the problem showed up. To your first question, the answer is yes, I run the cli and the Auth is working well, I can do all the login register without problemas. The problem appears when I use API.graphql
. I'm trying to check that @aws-amplify/api
is imported after the @aws-amplify/core
. Here is an example of my console logs:
I solved it by removing aws-amplify
package and installing the individual feature packages
that is weird. But glad you solved it.
On Thu, 20 Jun 2019 at 09:15, Adrian Hernandez-Mendez < notifications@github.com> wrote:
I solved it by removing aws-amplify package and installing the individual feature packages [image: Bildschirmfoto 2019-06-20 um 01 13 58] https://user-images.githubusercontent.com/3098149/59807561-c4a1e600-92f8-11e9-807a-3a2e3b0c20f3.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/1571?email_source=notifications&email_token=ABIKJK5BZ66TDVVXQSKBKD3P3K4YDA5CNFSM4FTERFNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYDRIAQ#issuecomment-503780354, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIKJK6XJ3QNMJZLJ3WJKXDP3K4YDANCNFSM4FTERFNA .
make sureaws-exports.js
at the same level as App.js
I had the same issue as @adrianhdezm and the solution they mentioned fixed it for me.
I received this error when Amplify had not finished checking for a valid user session. My solution was to use the Hub to listen to the auth's configured
event, then update my React app's state for my user
and then fire the API calls I was trying to do after the user
is valid.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
I keep getting "Api no configured" when calling the API.
src/aws-exports.js looks like this: `
I've tried setting it up manually. Same results.
in App.js