import { APIResponseData } from "~/server/utils/types";
import { prisma } from "../../../prisma/db";
import {
GetUsersInputSchema,
GlobalQueryResponseOutputSchemaInputType,
} from "~/server/utils/validators";
// import { getAuthSession } from "~/server/utils/admin";
import { getServerSession, getServerToken } from "#auth";
import { authOptions } from "../auth/[...]";
// import protectAdmin from "../../utils/validators/admin";
export default defineEventHandler(async (event) => {
// await protectAdmin(event);
const session = await getServerSession(event, authOptions);
const jwt = await getServerToken(event, authOptions);
console.log(session, jwt);
return `API route`;
});
[nuxt] [request error] [unhandled] [500] No Origin found ...
at getServerOrigin (./node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@hebilicious/authjs-nuxt/dist/runtime/utils.mjs:15:11)
at getServerToken (./node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@hebilicious/authjs-nuxt/dist/runtime/lib/server.mjs:47:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (./server/api/users/index.get.ts:17:1)
at async Object.handler (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1630:19)
at async Server.toNodeHandle (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1840:7)
import { resolve } from "node:path";
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ["@nuxt/ui", "@hebilicious/authjs-nuxt", "vue-email/nuxt"],
ui: {
icons: ["logos", "mdi"],
},
alias: {
cookie: resolve(__dirname, "node_modules/cookie"),
},
// Optional default config
authJs: {
baseUrl: process.env.NUXT_NEXTAUTH_URL, // should be something like https://www.my-app.com
verifyClientOnEveryRequest: true,
// guestRedirectTo: "/", // where to redirect if the user is authenticated
// authenticatedRedirectTo: "/", // where to redirect if the user is not authenticated
},
runtimeConfig: {
authJs: {
secret: process.env.NUXT_NEXTAUTH_SECRET, // You can generate one with `openssl rand -base64 32`
},
discord: {
clientId: process.env.NUXT_DISCORD_CLIENT_ID,
clientSecret: process.env.NUXT_DISCORD_CLIENT_SECRET,
},
email: {
senderAddress: process.env.NUXT_EMAIL_SENDER_ADDRESS,
serverUsername: process.env.NUXT_EMAIL_SERVER_USERNAME,
serverPassword: process.env.NUXT_EMAIL_SERVER_PASSWORD,
serverHost: process.env.NUXT_EMAIL_SERVER_HOST,
serverPort: Number(process.env.NUXT_EMAIL_SERVER_PORT),
},
google: {
clientId: process.env.NUXT_GOOGLE_CLIENT_ID,
clientSecret: process.env.NUXT_GOOGLE_CLIENT_SECRET,
},
organization: {
name: process.env.NUXT_ORGANIZATION_NAME,
domain: process.env.NUXT_ORGANIZATION_HOST_DOMAIN,
},
public: {
authJs: {
baseUrl: process.env.NUXT_NEXTAUTH_URL, // The URL of your deployed app (used for origin Check in production)
verifyClientOnEveryRequest: true, // whether to hit the /auth/session endpoint on every client request
},
},
},
});
I can't figure out why it's still throwing the error.