Closed heathharrelson closed 1 week ago
The essential problem here is that window
is undefined
when the authentication middleware runs server-side.
Cannot read properties of undefined (reading 'location')
at ./middleware/auth.ts:9:19
at ./node_modules/nuxt/dist/pages/runtime/plugins/router.js:161:61
at fn (./node_modules/nuxt/dist/app/nuxt.js:192:44)
at Object.callAsync (./node_modules/unctx/dist/index.mjs:68:55)
at ./node_modules/nuxt/dist/app/nuxt.js:194:56
at Object.runWithContext (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3955:18)
at callWithNuxt (./node_modules/nuxt/dist/app/nuxt.js:194:24)
at ./node_modules/nuxt/dist/app/nuxt.js:36:54
at EffectScope.run (./node_modules/@vue/reactivity/dist/reactivity.cjs.js:47:16)
at Object.runWithContext (./node_modules/nuxt/dist/app/nuxt.js:36:44)
This causes the 404 page that is displayed before the client-side app boots. The fix was to use state that is available in both environments.
Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-wave-082988910-128.centralus.4.azurestaticapps.net
Use runtime configuration to construct the login redirect URL instead of
window.location
, which isn't available server-side. Fixes #116.