Roncho
BABetter Auth
•Created by Roncho on 3/14/2025 in #help
How to seed users?
ok, i'll try that, thanks!
8 replies
BABetter Auth
•Created by Roncho on 3/14/2025 in #help
How to seed users?
and the error is:
Error:
cookies
was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context8 replies
BABetter Auth
•Created by Roncho on 3/14/2025 in #help
How to seed users?
Here is my seeding script:
"use server";
import prisma from "@/lib/prisma";
import users from "./data/users.json";
import { auth } from "@/lib/auth";
async function main() {
for (const user of users) {
console.log(
Creating user ${user.email}
);
await auth.api.signUpEmail({
body: {
email: user.email,
password: user.password,
name: user.name,
role: user.role,
},
});
}
}
// run it
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});8 replies
BABetter Auth
•Created by Roncho on 3/14/2025 in #help
How to seed users?
thanks. getting this error:
Creating user [email protected]
Error:
cookies
was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context8 replies