Closed rpostulart closed 4 years ago
@rpostulart Could you share your aws-exports file with secrets grayed out?
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
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": "AWS_IAM", "aws_cognito_identity_pool_id": "eu-west-1:c**", "aws_cognito_region": "eu-west-1", "aws_user_poolsid": "eu-west-1***", "aws_user_pools_web_client_id": "**", "oauth": {}, "predictions": { "interpret": { "interpretText": { "region": "eu-west-1", "proxy": false, "defaults": { "type": "LANGUAGE" } } } } };
export default awsmobile;
I am also having problems with the comprehend API from a vue application. (400 bad request error) throwing asyncToGenerator.js?1da1:6 Uncaught (in promise) Not authorized, did you enable Interpret Text on predictions category Amplify CLI? try: amplify predictions add.
** Have already added the predictions category and checked in my cloud formation logs that everything has been provisioned.
EDIT
I have managed to get it working for Auth users by updgrading both the vue plugin and amplify to the latest stable releases, however users that are associated to certain groups are not inheriting the permissions to make the calls to comprehend.
**
I have followed similar steps above with main.js.
import Amplify, * as AmplifyModules from "aws-amplify"; import { AmplifyPlugin } from "aws-amplify-vue"; import awsconfig from "./aws-exports";
Amplify.configure(awsconfig); import { AmazonAIPredictionsProvider } from '@aws-amplify/predictions' Amplify.addPluggable(new AmazonAIPredictionsProvider())
and vue component.
import Predictions from '@aws-amplify/predictions';
interpretText: async function() {
await Predictions.interpret({
text: {
source: {
text: this.inputText,
language: "en-US"
},
type: "SENTIMENT"
}
}).then(response => {
console.log(response);
});
return;
},
I have added predictions via the amplify cli and it only happend when I upgraded to the latest amplify modular versions. So yes I am up to date. With version 2.7.0 it worked
@rpostulart, can you try importing Auth from @aws-amplify/auth
and call Auth.configure(awsexports)
on it, OR alternatively try changing your Amplify import from @aws-amplify/core
to import Amplify from 'aws-amplify'
and let us know if either or both work?
With the modularization, we have removed importing all Amplify categories by default in your app. Guest access/unauthorized access requires Auth category to be properly bootstrapped and configured. If you are only importing specific categories, Auth is required to be imported for Guess access as mentioned in the Analytics category https://docs.amplify.aws/lib/analytics/getting-started/q/platform/js#using-modular-imports I'll add more details to this section and add in other categories too.
Thanks @Amplifiyer !
This (@aws-amplify/auth and call Auth.configure(awsexports) did the job.
his (@aws-amplify/auth and call Auth.configure(awsexports) did the job
Like @rpostulart said, this fixed it for me.
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.
When I use this code:
and run this function:
Then I receive this error
when I replace the import statements with this:
Then I receive this error:
this is my package.json: