Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

1.1 KB
Raw Blame
---
title = "Auth Hooks: 'Invalid payload' when anonymous users attempt phone changes"
topics = [ "auth", "cli" ]
keywords = []
database_id = "c1de4561-e95f-41e3-b298-fac9ae331a54"

[[errors]]
http_status_code = 500
message = "Invalid payload sent to hook"
---

An 'Invalid payload sent to hook' error (500) occurs in [Auth hooks](/docs/guides/auth/auth-hooks) when the payload includes `new_phone` for an anonymous user.

## Why does this happen?

This error arises because anonymous users do not have an existing phone number to modify. Client application logic attempting a `phone_change` for such users results in an invalid operation. The `new_phone` field should only be present during a `phone_change` flow initiated by an _authenticated_ user.

## How to avoid this issue

Refine your client application logic to prevent this incorrect payload structure:

- Differentiate phone update and login flows for anonymous users from authenticated users.
- Ensure `new_phone` is only transmitted when an authenticated user initiates a `phone_change` flow.
- Implement distinct handling for anonymous user updates to avoid sending `new_phone` in the payload.