cardinal
cardinal
BABetter Auth
Created by cardinal on 3/3/2025 in #help
Am trying to create an org when a user signed up.
@bekacru could I get some input on this?
7 replies
BABetter Auth
Created by cardinal on 3/3/2025 in #help
Am trying to create an org when a user signed up.
I mean I could create the organization with prisma, but then I still need to add member to the org
7 replies
BABetter Auth
Created by cardinal on 3/3/2025 in #help
Am trying to create an org when a user signed up.
you mean like this should work?
databaseHooks: {
user: {
create: {
after: async (user) => {
await auth.api.createOrganization({
body: {
name: "Default",
slug: "default",
},
});
},
},
},
},
databaseHooks: {
user: {
create: {
after: async (user) => {
await auth.api.createOrganization({
body: {
name: "Default",
slug: "default",
},
});
},
},
},
},
this is the error I got with that
2025-03-03T17:58:08.954Z ERROR [Better Auth]: APIError
# SERVER_ERROR: TypeError: Cannot destructure property 'session' of 'result.data' as it is null.
at file:///Users/jaynguyens/Workspaces/uppareach/node_modules/better-auth/dist/shared/better-auth.DEf1xRKI.mjs:1762:13
at internalHandler (file:///Users/jaynguyens/Workspaces/uppareach/node_modules/better-call/src/endpoint.ts:321:20)
at api.<computed> (file:///Users/jaynguyens/Workspaces/uppareach/node_modules/better-auth/dist/api/index.mjs:474:22)
2025-03-03T17:58:08.954Z ERROR [Better Auth]: APIError
# SERVER_ERROR: TypeError: Cannot destructure property 'session' of 'result.data' as it is null.
at file:///Users/jaynguyens/Workspaces/uppareach/node_modules/better-auth/dist/shared/better-auth.DEf1xRKI.mjs:1762:13
at internalHandler (file:///Users/jaynguyens/Workspaces/uppareach/node_modules/better-call/src/endpoint.ts:321:20)
at api.<computed> (file:///Users/jaynguyens/Workspaces/uppareach/node_modules/better-auth/dist/api/index.mjs:474:22)
7 replies