Second time in a month, signups are broken in my live production environment.
When a user signs up they get this GraphQL error now:
message: "Cannot add or update a child row: a foreign key constraint fails (`8base_5dab9152b0bf73f9211c2747`.`UsersRoles`, CONSTRAINT `UsersRoles_ibfk_1` FOREIGN KEY (`userAId`) REFERENCES `Users` (`id`))"
I haven’t changed anything about user creation since it was working before.
More info:
This is using signupUserWithPassword
The 1 role which might be relevant is Guest
. The Guest role obviously has permissions to Read, Update and Create everything on User. So shouldn’t be a permissions issue.
My Signup logic doesn’t deal with Roles at all, and I have nothing. named “userAId” so I’m pretty sure this is an internal 8base issue.
@MarkLyck it looks like you are returning incorrect data from after trigger.
https://docs.8base.com/docs/8base-console/custom-functions/triggers
You should return
return {
data: {
...event.data,
sent
}
}
}
but it looks like you are retuning
data: {
result: "success"
},
instead
1 Like
@evgeny.semushin Wow really sorry for labeling that as an emergency, and thank you SO SO much for figuring this out in such a short time.
I had no idea that the return of an After trigger would break User creation.
If anything if it did cause a change After the user was created, I would expect the function to throw an error but not Delete and break the entire signup.
Again I apologize for my mistake and mislabeling of this issue.
After switching the .after trigger back to return event.data signups are working again :phew: