I just simply followed the instruction for configuring AWS-AMPLIFY for SSR in Nuxt in the document, and everything works except when I tried to use signOut. I get the error above.
fetchAuthSession,
fetchUserAttributes,
signIn,
signUp,
signOut,
confirmSignUp,
confirmSignIn,
confirmResetPassword,
getCurrentUser,
resendSignUpCode,
} from 'aws-amplify/auth'
import { generateClient } from 'aws-amplify/data'
import outputs from '@/amplify_outputs.json'
import type { Schema } from '@/amplify/data/resource'
import { Amplify } from 'aws-amplify'
// configure the Amplify client library
if (import.meta.client) {
Amplify.configure(outputs, { ssr: true })
}
// generate your data client using the Schema from your backend
const client = generateClient<Schema>()
export default defineNuxtPlugin({
name: 'AmplifyAPIs',
enforce: 'pre',
setup() {
return {
provide: {
// You can call the API by via the composable `useNuxtApp()`. For example:
// `useNuxtApp().$Amplify.Auth.fetchAuthSession()`
Amplify: {
Auth: {
fetchAuthSession,
fetchUserAttributes,
getCurrentUser,
confirmSignUp,
confirmSignIn,
confirmResetPassword,
resendSignUpCode,
signIn,
signOut,
signUp,
},
GraphQL: {
client,
},
},
},
}
},
})