Error: Failed to handle signup webhook

// https://selftaught-dev.com/
happy-hugle-97373a
// GitHub - ghughes13/SelfTaughtDev

Did Netlify have any big updates/changes in the past few days? The most recent thing I can find (News & Announcements | Netlify Blog) is from the 18th.

I’m using Netlify identity to let users sign up on my site. Haven’t had any issues with it until recently. The most recent sign up is from 3 days ago and now when anyone tries to sign up they get a “failed to handle signup webhook” error and a 422 error in the console. The build I’ve been using is from a month ago so I haven’t made any recent changes to the code. Anyone have any ideas what might have changed to cause this?

Ahh apparently it’s looking for a file called “signup.js” instead of “identity-signup.js” now. After renaming it to ‘signup.js’ in my functions folder, it worked.

1 Like

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.

1 Like

Hey there, @hemond.colby :wave:

Thank you for sharing this series of steps with the Netlify Forums! It will be very helpful for any other individual who may find themselves facing a similar situation.

1 Like

Did you resolve this issue?

Hey @aoloo,

Instead of replying in all the old threads, it would be great if you can create a new thread with all the relevant details.

EDIT: Please continue in your own thread here: