Trying to use Netlify identity to handle user signup. It works wonderfully!..Unless I try to use the ‘identity-signup.js’ webhook. It worked great back in November (It could send the user info to my database and update their role in Netlify identity), but then it randomly stopped working and started giving user a “Failed to handle signup webhook” error when they’d try to create a new account on my site (see below img).
I have deleted everything in my identity-signup.js function and this is all I’ve got in it now, but it still gives me a 422 and a “failed to handle signup webhook” error.
Hi @ghughes13, I’m not sure what’s going on yet but I do see our logs showing a 403 Forbidden response from your identity-signup.js function. Unfortunately, event-triggered functions don’t show log entries. Could you rename the function and then set an Identity notification here: Netlify App. This will let you see any logs/errors in the function itself and that would help find out why it’s returning a 403.
I couldn’t figure out why the identity-signup.js function wouldn’t work/was giving me a 422. When the ‘identiy-signup.js’ function/file doesn’t exist, I can successfully register new users, so I just hacked around it with the info @Dennis gave me.
I set up a webhook here Netlify App and copy/pasted my code from identity-signup.js, and everything works as it should again.
I have not made any changes to the functions from the sample except for running ESLint on them to keep the formatting and style consistent with the rest of my project.
It turned out the problem for me was very silly. In Stripe, I set the products to be one-time thinking they would act as lifetime subscriptions. Evidently, that single change was enough to break
// subscribe the new customer to the free plan
await stripe.subscriptions.create({
customer: customer.id,
items: [{ price: process.env.STRIPE_DEFAULT_PRICE_PLAN }]
})
So, creating the customer in Stripe just above that ( const customer = await stripe.customers.create({ email: user.email }) ) worked - the customer would show up in Stripe - but creating the subscription failed because Stripe did not consider my one-time product as a subscription, and then the Fauna DB mutation subsequently failed.
After I set the product to be recurring again, identity-signup.js worked just fine. The HTTP requests and responses were fine, the customer showed up in Stripe with the subscription, and the mutation showed up in Fauna DB.
I did change the structure of the functions, but that does not appear to be significant. Here’s the structure anyway just in case: