import Amplify from 'aws-amplify';
import { awsmobile } from './src/aws-exports';
import { Auth, API } from 'aws-amplify';
Amplify.configure(awsmobile);
This is my setup for Amplify. Auth is working properly however whenever I'm calling API, it gives me a promise rejection "API no configured". I looked into auth.ts and it seems like its returning false when calling createInstance(). I'm not sure what's causing this, has anyone encountered this and been able to fix the issue? If you need more information to answer please let me know.
Hi @dkimm96 do you have the API configuration in your aws-exports.js? This may be caused because there is no cloud_logic settings in that file.
@powerful23 I have aws_cloud_logic as “enable” and aws_cloud_logic_custom as list of my APIs. I used “import existing API” from mobile hub to set this up.
@dkimm96 can you paste here what your aws-exports aws_cloud_logic_custom property looks like minus any sensitive info like the endpoint ids. It should looks something like this:
{
'aws_cloud_logic_custom':
[{"id":"xxxxxx","name":"sampleCloudApi","description":"","endpoint":"https://xxxxxx.execute-api.us-east-1.amazonaws.com/Development","region":"us-east-1","paths":["/items","/items/123"]}]
}
Also, what region are you running in?
@mlabieniec
'aws_cloud_logic_custom': [{"id":"xxxxxxx","name":"example","description":"example details","endpoint":"https://xxxxxxx.execute-api.us-east-2.amazonaws.com/prod","region":"us-east-2","paths":["/example-path"]},{"id":"xxxxyyy","name":"example2","description":"example details 2","endpoint":"https://xxxxyyy.execute-api.us-east-2.amazonaws.com/prod","region":"us-east-2","paths":["/example-path1","/example-path2","/example-path3","/example-path4","/example-path5","/example-path6","/example-path7","/example-path8","/example-path9"]},{"id":"xyxyxyxy","name":"example3","description":"example details 3","endpoint":"https://xyxyxyxy.us-east-2.amazonaws.com/prod","region":"us-east-2","paths":["/example-path1","/example-path2","/example-path3","/example-path4","/example-path5","/example-path6","/example-path7","/example-path8"]}],
This is my custom cloud logic. I replaced the real information with examples. I'm running in region us-east-2 (Ohio)
@dkimm96 sorry to be late. I think you need to remove those brackets: import awsmobile from './src/aws-exports'
Most helpful comment
@dkimm96 sorry to be late. I think you need to remove those brackets:
import awsmobile from './src/aws-exports'