amplify-js: Uncaught Error: More than one or no providers are configured

I’m trying to use text translation from amplify predictions in vue and while following docs I’m getting error

“Uncaught Error: More than one or no providers are configured, Either specify a provider name or configure exactly one provider”

I do have other stuff going on which may be influencing issue such as analytics. Trying to just call as basic as possible to get working here. Also not sure if I’m posting this issue as I’m supposed or not this is my first time doing this.

import "./plugins/vuetify";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./registerServiceWorker";
import Amplify, * as AmplifyModules from "aws-amplify";
import { AmplifyPlugin } from "aws-amplify-vue";
import awsmobile from "./aws-exports";
import Vuetify from "vuetify";
import Analytics from '@aws-amplify/analytics';
import Predictions, { AmazonAIPredictionsProvider } from '@aws-amplify/predictions';
Amplify.addPluggable(new AmazonAIPredictionsProvider());
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);

  Predictions.convert({
  translateText: {
    source: {
      text: 'hello',
      language : "en" // defaults configured on aws-exports.js
      // supported languages https://docs.aws.amazon.com/translate/latest/dg/how-it-works.html#how-it-works-language-codes
    },
    targetLanguage: "fr"
    }
  }).then(result => console.log(JSON.stringify(result, null, 2)))
    .catch(err => console.log(JSON.stringify(err, null, 2)))
Analytics.configure();
Analytics.autoTrack('session', {
  enable: true,
  attributes: {
      attr: 'attr'
  },
});
Analytics.autoTrack('pageView', {
  enable: true,
  eventName: 'pageView',
  attributes: {
      attr: 'attr'
  },
  type: 'SPA',
});
Amplify.configure(awsmobile);
Vue.use(AmplifyPlugin, AmplifyModules);
Vue.config.productionTip = false;
Vue.use(Vuetify, {
  theme: {
    primary: "#00f",
    secondary: "#000",
  }
}),
  new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount("#app");

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same problem with the newest 3.* version. Adding the following to my main.ts seemed to fix it for me.

Amplify.configure(awsconfig);

Amplify.register(Predictions);
Predictions.addPluggable(new AmazonAIPredictionsProvider());

Updating from version 3.1.21 to 3.1.22 and the latest 3.1.23 resulted in this error.

I had the same problem with the newest 3.* version. Adding the following to my main.ts seemed to fix it for me.

Amplify.configure(awsconfig);

Amplify.register(Predictions);
Predictions.addPluggable(new AmazonAIPredictionsProvider());

Thanks man! It fixed my issue, you’re awesome : )

I am still facing this issue. “amazon-cognito-identity-js”: “^4.5.10”, “aws-amplify”: “^3.3.19”, “aws-amplify-react-native”: “^4.3.1”

import Amplify from ‘aws-amplify’; import Predictions, { AmazonAIPredictionsProvider, } from ‘@aws-amplify/predictions’;

import config from ‘./src/aws-exports’; Amplify.configure(config); Amplify.addPluggable(new AmazonAIPredictionsProvider());

Screenshot 2021-02-18 at 10 13 00 AM