Search code examples
expressvue.jsaws-amplifyaws-config

Uncaught TypeError: at.a is undefined


I have a Vue 2 web app that uses AWS Amplify. I have another app almost exactly like it in every way and it works fine, but for some reason I cannot get this one to work in production.

Locally in dev, everything works just fine.

When I build and launch it with Express, it doesn't load the website. Only when I remove "Amplify.configure(awsconfig);" from src/main.js does it load, but, of course, none of the AWS related functionality (API calls) work.

I get the following error on the console:

Uncaught TypeError: at.a is undefined
    56d7 main.js:12
    Webpack 6

At main.js line 12 is "Amplify.configure(awsconfig);"

/* eslint-disable */

import Vue from "vue";
import App from "./App.vue";
import router from "./router.js";
import Amplify from "aws-amplify";

// Material plugins
import MaterialKit from "./plugins/material-kit";

import awsconfig from "./aws-exports";
Amplify.configure(awsconfig);
Vue.config.productionTip = false;

Vue.use(MaterialKit);

new Vue({
  router,
  render: h => h(App)
}).$mount("#app");

The site is very simple and is set up just like my other one that works, so this is very confusing.

Any idea what the issue could be? Let me know if you need any other code snippets.


Solution

  • Where I import Amplify at the top, it shouldn't be

    import Amplify from "aws-amplify";
    

    but instead

    import { Amplify } from "aws-amplify";
    

    This is strange because my other project does the first version and works fine.