-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
The inferred type of 'createAuth' cannot be named without a reference to '.pnpm/@simplewebauthn+server@13.1.1/node_modules/@simplewebauthn/server' #2036
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workinglockedLocked conversations after being closed for 7 daysLocked conversations after being closed for 7 days
Description
Is this suited for github?
- Yes, this is suited for github
To Reproduce
pnpm monorepo + turborepo
"better-auth": "^1.2.5",
import type { db } from "@/db/db"; // your drizzle instance
import { betterAuth, Auth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import {
admin,
anonymous,
apiKey,
bearer,
openAPI,
organization,
username,
} from "better-auth/plugins";
import { passkey } from "better-auth/plugins/passkey";
import type { Logger } from "logger";
import { SERVICE_URLS } from "shared";
import { env } from "./env";
export const createAuth = (props: {
db: db;
logger?: Logger;
}) => {
return betterAuth({
baseURL: SERVICE_URLS[env.APP_ENV].auth,
basePath: "/api/auth",
trustedOrigins: [
SERVICE_URLS[env.APP_ENV].frontend,
SERVICE_URLS[env.APP_ENV].api,
],
database: drizzleAdapter(props.db, {
provider: "pg", // or "mysql", "sqlite"
}),
plugins: [
openAPI(),
anonymous(),
username(),
passkey(),
admin(),
organization(),
bearer(),
apiKey(),
],
emailAndPassword: {
enabled: true,
},
logger: {
level: env.LOG_LEVEL === "trace" ? "debug" : env.LOG_LEVEL,
log(level, message, ...args) {
props.logger?.[level](message, ...args);
},
},
advanced: {
generateId: false, // ids are generated by drizzle automatically and follow the format defined in shared/id
},
});
};
Current vs. Expected behavior
typescript should compile without issues, but here we are getting some infernce issues
What version of Better Auth are you using?
1.2.5
Provide environment information
bun 1.2.6
pnpm 10
pnpm monorepoWhich area(s) are affected? (Select all that apply)
Types
Auth config (if applicable)
import type { db } from "@/db/db"; // your drizzle instance
import { betterAuth, Auth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import {
admin,
anonymous,
apiKey,
bearer,
openAPI,
organization,
username,
} from "better-auth/plugins";
import { passkey } from "better-auth/plugins/passkey";
import type { Logger } from "logger";
import { SERVICE_URLS } from "shared";
import { env } from "./env";
export const createAuth = (props: {
db: db;
logger?: Logger;
}) => {
return betterAuth({
baseURL: SERVICE_URLS[env.APP_ENV].auth,
basePath: "/api/auth",
trustedOrigins: [
SERVICE_URLS[env.APP_ENV].frontend,
SERVICE_URLS[env.APP_ENV].api,
],
database: drizzleAdapter(props.db, {
provider: "pg", // or "mysql", "sqlite"
}),
plugins: [
openAPI(),
anonymous(),
username(),
passkey(),
admin(),
organization(),
bearer(),
apiKey(),
],
emailAndPassword: {
enabled: true,
},
logger: {
level: env.LOG_LEVEL === "trace" ? "debug" : env.LOG_LEVEL,
log(level, message, ...args) {
props.logger?.[level](message, ...args);
},
},
advanced: {
generateId: false, // ids are generated by drizzle automatically and follow the format defined in shared/id
},
});
};Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinglockedLocked conversations after being closed for 7 daysLocked conversations after being closed for 7 days