N
Neon2d ago
vicious-gold

Creating a user doesn't insert the user immediatly (Neon AUTH)

Hey, I'm using neon auth with stackserverApp SDK and I need to use the created userId in another table. My problem is that when I try to insert the created userId in my table that has a FK to usersSync table, it throws an error telling me that the user doesn't exists 🫤 Does someone know if the stackServerApp.createUser() function could accept a transaction to create user and insert it in my other table and rollback if there was an error ? Thanks for your help 😄
1 Reply
afraid-scarlet
afraid-scarletthis hour
Hey! I believe its 1 of 2 things : 1. Neon doesn't support branching with Neon Auth, so if you're on a branch different to the one you created the integration on, you wont ever see those users. 2. You're trying to access a user that you just created in the users_sync table before the web-hook has finished running and inserted the new user into the table. To answer your other question, no, stackServerApp.createUser() will not accept a transaction to create a user and insert it. The actually auth lives in their database, you just get a sync of it.

Did you find this page helpful?