Hi everyone! BE engineer dipping my toes in web dev thanks to Wasp. Struggling to implement an OnAfterSignup hook based on the 0.14.0 release instructions, but my hook isn't triggered on signup.
# app/src/auth/hooks.ts (new file)import type { OnAfterSignupHook } from 'wasp/server/auth';export const onAfterSignup: OnAfterSignupHook = async ({ providerId, user, oauth, prisma, req }) => { console.log('onAfterSignup hook triggered');};
# app/src/auth/hooks.ts (new file)import type { OnAfterSignupHook } from 'wasp/server/auth';export const onAfterSignup: OnAfterSignupHook = async ({ providerId, user, oauth, prisma, req }) => { console.log('onAfterSignup hook triggered');};
I then sign up using gmail. Sign up succeeds and I'm logged in, but my hook isn't triggered: - No "onAfterSignup hook triggered" was logged to the console - I see a "GET http://localhost:3001/auth/me 401 (Unauthorized)" in the console, which includes a frame "queryFn @ hooks.ts:32" (this is
.wasp/out/sdk/wasp/client/operations/hooks.ts
.wasp/out/sdk/wasp/client/operations/hooks.ts
)
Checked/Tried: [x] User doesn't exist in the database already - though I'm using the same email address multiple times, could that cause the hook to not be triggered? [x] Using the different signature shown in the X post- though not sure why the signature is different [x] Signed up with email/password instead of gmail - same result [x] I have the correct Wasp version (0.14.0)
Am I missing something? Many thanks in advance, any help is appreciated
Starting with pre and post-signup hooks. They allow you to, e.g.: - control which emails can register, - send personalized welcome emails, - or keep your user data in sync with 3rd party services