Unfortunately just changing the name of the file from “identity-signup.js” to “signup.js” didn’t work for me. However, my scenario is different in the fact that I am working on implementing identity-functions and did not previously have them implemented when I received the “Error: Failed to handle signup webhook” error. Therefore, I am leaving this here in case someone finds this thread because they are in the same situation as I was.
Here is what my issue was:
I was implementing “identity-validate.js” to perform some validation during sign up to prevent certain users from creating an account. I used the below code(removed and changed some values so it may not work with a copy paste) to test out what the error process would look like:
exports.handler = function (event, context, callback) {
const data = JSON.parse(event.body);
const { user } = data;
if (data.user.email == 'foo@foobar.com') {
return callback(null, {
statusCode: 400,
body: JSON.stringify(responseBody)
});
}
};
This was returning the “Error: Failed to handle signup webhook” error directly in the signup form. And the network was showing “signup” with a 422 response code (which was different than the 400 I set in my function).
I didn’t think much of it and just wanted a more descriptive error message, which lead me to this post, Passing errors with Identity trigged functions, where issue, Passing error messages from Identity triggered webhooks to client #212, was opened with the GoTrue API. Which let me know that I can get a custom error message to be returned.
I was still slightly confused why it was only “signup” in the error, and thought there had to be more to the process, so I figured I had to implement the “identity-signup.js” function as well. That didn’t change the error at all, which led me to this post that you’re on. I tried changing the file name as suggested, which did not work.
I decided to use my brain a little more and search for the “Error: Failed to handle signup webhook” string in the GoTrue API, and it turns out that that string is returned for just about any error.
Hope this rambling helps save someone some time.