organization plugin types issue
this is my auth.ts file
Now any organiation api here doesnt work, on sevrer if I cann auth.api.listmemebrs, its not defiend and its for all orgs apis.
my tsconfig
import { betterAuth } from 'better-auth';
import { db } from '../db';
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
import { twoFactor, organization } from 'better-auth/plugins';
import { getEnv } from '../utils';
// import { sendEmail } from './email';
export const auth: ReturnType<typeof betterAuth> = betterAuth({
database: drizzleAdapter(db, {
provider: 'pg',
usePlural: true,
}),
emailAndPassword: {
enabled: true,
requireEmailVerification: getEnv('NODE_ENV') !== 'development',
},
emailVerification: {
sendOnSignUp: true,
autoSignInAfterVerification: true,
sendVerificationEmail: async ({ user, url, token }, request) => {},
},
rateLimit: {
enabled: true,
maxRequests: 10,
windowMs: 60 * 1000,
},
trustedOrigins: ['http://localhost:3000', 'http://localhost:3001'],
plugins: [
...(getEnv('NODE_ENV') !== 'development'
? [twoFactor(), organization()]
: [organization()]), //Use two-factor authentication only in production
],
});
import { betterAuth } from 'better-auth';
import { db } from '../db';
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
import { twoFactor, organization } from 'better-auth/plugins';
import { getEnv } from '../utils';
// import { sendEmail } from './email';
export const auth: ReturnType<typeof betterAuth> = betterAuth({
database: drizzleAdapter(db, {
provider: 'pg',
usePlural: true,
}),
emailAndPassword: {
enabled: true,
requireEmailVerification: getEnv('NODE_ENV') !== 'development',
},
emailVerification: {
sendOnSignUp: true,
autoSignInAfterVerification: true,
sendVerificationEmail: async ({ user, url, token }, request) => {},
},
rateLimit: {
enabled: true,
maxRequests: 10,
windowMs: 60 * 1000,
},
trustedOrigins: ['http://localhost:3000', 'http://localhost:3001'],
plugins: [
...(getEnv('NODE_ENV') !== 'development'
? [twoFactor(), organization()]
: [organization()]), //Use two-factor authentication only in production
],
});
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
2 Replies
Disable declaration and declarationMap
what if you're using a monorepo? kind of breaks things