import '@total-typescript/ts-reset'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import { version } from './package.json'
export default defineNuxtConfig({
ssr: false,
runtimeConfig: {
indexable: true,
},
modules: [
'@nuxt/devtools',
'@nuxt-alt/auth',
'@nuxt-alt/http',
'@nuxtjs/color-mode',
'@nuxtjs/plausible',
'@nuxtseo/module',
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
'@unocss/nuxt',
'@vueuse/nuxt',
'nuxt-icon',
],
imports: {
dirs: [
'./stores',
],
},
experimental: {
headNext: true,
},
sourcemap: {
server: process.env.NODE_ENV !== 'test',
client: process.env.NODE_ENV !== 'test',
},
devtools: {
enabled: false,
},
app: {
head: {
htmlAttrs: {
lang: 'en',
translate: 'no', // Avoid translation.
},
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' },
],
},
},
vite: {
build: {
sourcemap: true,
},
plugins: [
// Sentry Vite plugin needs to be after all other plugins.
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'promptmetheus',
project: 'archery',
release: {
name: version,
},
telemetry: false,
}),
],
},
typescript: {
shim: false,
},
css: [
'vue-toastification/dist/index.css',
'assets/postcss/style.postcss',
],
postcss: {
plugins: {
'cssnano': false,
'postcss-nested': {},
},
},
nitro: {
routeRules: {
'/*': { prerender: false }, // Note: for some reason / is prerendered by default, which breaks the auth middleware.
},
prerender: {
crawlLinks: false, // Note: SEO Kit is setting this to true.
},
},
piniaPersistedstate: {
storage: 'localStorage',
},
http: {
baseURL: process.env.API_URL,
browserBaseURL: process.env.API_URL,
},
auth: {
globalMiddleware: true,
redirectStrategy: 'query', // IMPORTANT! Otherwise, there will be an infinite logout loop.
watchLoggedIn: true,
cookie: {
prefix: 'auth.',
options: {
path: '/',
secure: process.env.NODE_ENV === 'production', // Enable only in production.
sameSite: 'lax', // IMPORTANT!
},
},
redirect: {
login: '/login',
logout: '/login',
callback: '/login',
home: '/',
},
strategies: {
local: {
scheme: 'refresh',
token: {
property: 'access',
type: 'JWT',
},
refreshToken: {
property: 'refresh',
data: 'refresh', // IMPORTANT! Note that the refresh token is not a JWT token.
},
user: {
property: false,
},
endpoints: {
login: {
url: `${process.env.API_URL}/auth/token/`,
method: 'post',
},
refresh: {
url: `${process.env.API_URL}/auth/token/refresh/`,
method: 'post',
},
user: false,
logout: {
url: `${process.env.API_URL}/auth/logout/`,
method: 'post',
},
},
},
google: {
clientId: process.env.GOOGLE_CLIENT_ID,
responseType: 'code',
codeChallengeMethod: '', // This is important!
endpoints: {
scope: 'openid profile email',
token: `${process.env.API_URL}/auth/social/google/`,
userInfo: `${process.env.API_URL}/users/me/`,
},
token: {
// The token type needs to match the AUTH_HEADER_TYPES setting under
// SIMPLE_JWT in the Django settings (Bearer by default).
type: 'JWT',
property: 'access',
},
refreshToken: {
// The refresh token is not a JWT token!
property: 'refresh',
},
},
},
},
colorMode: {
classSuffix: '',
},
schemaOrg: {
enabled: false,
},
ogImage: {
enabled: false,
},
sitemap: {
include: [
'/',
'/register',
'/login',
'/reset-password',
],
},
})
Reproduction
Cannot reproduce locally, but suddenly getting a lot of these errors in production. I think it came in with @nuxt-alt/auth 3.1.1/3.1.2, but not sure, maybe earlier. Did anything change in the config?
Environment
Darwin
v21.5.0
3.9.0
3.10.0
2.8.1
pnpm@8.12.1
-
ssr
,runtimeConfig
,site
,modules
,imports
,experimental
,sourcemap
,devtools
,app
,vite
,typescript
,css
,postcss
,nitro
,piniaPersistedstate
,http
,auth
,colorMode
,plausible
,schemaOrg
,ogImage
,sitemap
@nuxt/devtools@1.0.6
,@nuxt-alt/auth@3.1.2
,@nuxt-alt/http@1.7.4
,@nuxtjs/color-mode@3.3.2
,@nuxtjs/plausible@0.2.4
,@nuxtseo/module@2.0.0-beta.55
,@pinia/nuxt@0.5.1
,@pinia-plugin-persistedstate/nuxt@1.2.0
,@unocss/nuxt@0.58.3
,@vueuse/nuxt@10.7.1
,nuxt-icon@0.6.8
-
Nuxt Config
Reproduction
Cannot reproduce locally, but suddenly getting a lot of these errors in production. I think it came in with
@nuxt-alt/auth 3.1.1/3.1.2
, but not sure, maybe earlier. Did anything change in the config?Describe the bug
Additional context
No response
Logs
No response