Netlify Identity Returning Malformed JSON Response

Netlify Site Name: peaceful-mccarthy-2e0b38

Hi, I’m using Netlify Identity, and new users are unable to register because email verification is failing. When users attempt to verify their email, the POST to /.netlify/identity/verify fails with the message, “Webhook returned malformed JSON: invalid character ‘<’ looking for beginning of value”.

Interestingly, allowing auto-confirm of email addresses causes this error to occur at time of sign-up rather than at confirmation.

This almost certainly means that you are receiving an HTML rather than JSON response. Have you tried POSTing to your endpoint yourself, to see what happens? Perhaps you get a “page not found” or instead a “permission denied”, or even a “syntax error” - all of which will return HTML resources even at a dynamic path that you expect to return JSON (if it ran correctly).

If you do the POST yourself from code, I suppose you can test like that and see what is coming back.

If not, but you can catch it happening in a HAR file (cf HAR Analyzer), perhaps we can help understand what is happening through that view.

Or, perhaps we can reproduce by ourselves - I see you have open invites for identity on - by inviting ourselves to your instance? What’s the preferred path to do that, if that’s how you’d like us to approach it?

Hello! I apologize for the delayed response.

This is a little confusing to me, as it’s Netlify’s endpoint, not ours. And it’s Netlify’s identity widget library that determines the endpoint when /#confirmation_token=xxxxxxxxxxxxx is added to the end of our url.

You’ve set a custom webhook: Identity | Site configuration | peaceful-mccarthy-2e0b38 | Netlify that’s sending HTML, not Netlify.

Hello. Thanks for your response. Removing this webhook indeed resolves the issue. But this webhook is simply to notify an administrator that a user has registered. It sends the user metadata to an endpoint. I don’t understand why that would interfere with the registration process. Also, this worked as is for a long time. Has something changed?

Additionally, I’m noticing now that if I disable auto-confirm (enable confirmation emails), Netlify is sending the HTML of the path specified to the email address. That wasn’t working like that before. It used to send a link to the site with a token param.

The webhook is supposed to return a 200, 202 or 204. If it returns a 200, we expect a JSON payload of the user that needs to be encoded as JWT. Since we expect JSON, you send HTML, it doesn’t work.

I’d hardly think so. Identity hasn’t changed for a long time.

You seem to have set the confirmation template:


Read here: Identity-generated emails | Netlify Docs