NUXT. Vue. Error 500 while accessing /api/login, while it works fine when running dev server.

Hi, I am using kinde with Nuxt, Vue, Nitro. While it works fine with run dev, it's giving server error 500 when running the build.
.app>node .output/server/index.mjs
Listening on http://[::]:3000
[nuxt] [request error] [unhandled] [500] Invalid URL
at new URL (node:internal/url:796:36)
at AuthorizationCode.<anonymous> (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:114:35)
at step (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:47:23)
at Object.next (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:28:53)
at fulfilled (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:19:58)
.app>node .output/server/index.mjs
Listening on http://[::]:3000
[nuxt] [request error] [unhandled] [500] Invalid URL
at new URL (node:internal/url:796:36)
at AuthorizationCode.<anonymous> (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:114:35)
at step (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:47:23)
at Object.next (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:28:53)
at fulfilled (/[PROJECT_PATH]/.app/.output/server/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/oauth2-flows/AuthorizationCode.js:19:58)
Same errors in browser console: `GET http://localhost:3000/api/login/ 500 (Internal Server Error) 10:08:19.956 w8GjRO4B.js:2 [nuxt] error caught during app initialization Error: Page not found: /api/login/ at tn (w8GjRO4B.js:2:20035) at w8GjRO4B.js:6:31212 at o (w8GjRO4B.js:2:18201) at Object.runWithContext (qTkC9Z7f.js:13:19110) at so (w8GjRO4B.js:2:18240) at w8GjRO4B.js:2:16245 at Or.run (qTkC9Z7f.js:9:267) at Object.runWithContext (w8GjRO4B.js:2:16237) at w8GjRO4B.js:6:31190 at w8GjRO4B.js:6:20763
2 Replies
Asad Malik
Asad MalikOP3w ago
My nuxt config:
modules: [// '@nuxt/devtools',
'@pinia/nuxt', 'nuxt-swiper', "@nuxt/image", '@nuxtjs/kinde'],
pinia: {
storesDirs: ['./stores/**'],
},

kinde: {
debug: true,
},
experimental: {
appManifest: false,
},
ssr: true,
nitro: {
prerender: {
crawlLinks: false,
},
esbuild: {
options: {
target: 'esnext',
},
},
modules: [// '@nuxt/devtools',
'@pinia/nuxt', 'nuxt-swiper', "@nuxt/image", '@nuxtjs/kinde'],
pinia: {
storesDirs: ['./stores/**'],
},

kinde: {
debug: true,
},
experimental: {
appManifest: false,
},
ssr: true,
nitro: {
prerender: {
crawlLinks: false,
},
esbuild: {
options: {
target: 'esnext',
},
},
and .env
NUXT_KINDE_CLIENT_ID=01b3______________________e6
NUXT_KINDE_CLIENT_SECRET=_________________y
NUXT_KINDE_AUTH_DOMAIN=https://auth.REAL_DOMAIN_NAME.com
NUXT_KINDE_REDIRECT_URL=http://localhost:3000/api/callback
NUXT_KINDE_LOGOUT_REDIRECT_URL=http://localhost:3000/api/login
NUXT_KINDE_PASSWORD=r_________39
NUXT_KINDE_POST_LOGIN_REDIRECT_URL=http://localhost:3000
NUXT_KINDE_CLIENT_ID=01b3______________________e6
NUXT_KINDE_CLIENT_SECRET=_________________y
NUXT_KINDE_AUTH_DOMAIN=https://auth.REAL_DOMAIN_NAME.com
NUXT_KINDE_REDIRECT_URL=http://localhost:3000/api/callback
NUXT_KINDE_LOGOUT_REDIRECT_URL=http://localhost:3000/api/login
NUXT_KINDE_PASSWORD=r_________39
NUXT_KINDE_POST_LOGIN_REDIRECT_URL=http://localhost:3000
I am sure I am missing some setting here. Can you please point me to the right direction? Thank you.
Claire_Kinde
Claire_Kinde3w ago
Are you using a Kinde SDK? If so can you tell me which one and what version? Also sorry for the delayed response.
Want results from more Discord servers?
Add your server