Andre Shalan
Andre Shalan

Reputation: 115

Clerk Expo SDK throws "first_name is not a valid parameter for this request" on user.update()

I'm trying to update user's firstName from ReactNavite app using @clerk/clerk-expo SDK:

  const { user } = useUser();

  const [firstName, setFirstName] = useState(user?.firstName ? user.firstName : "");

  const onUpdatePress = async () => {
    try {
      await user?.update({ firstName: firstName });
    } catch (err: any) {
      setErrorMessage(err.errors[0].longMessage);
      console.error(JSON.stringify(err, null, 2));
    }
  };

But it throws error:

 ERROR  {
  "status": 422,
  "clerkError": true,
  "errors": [
    {
      "code": "form_param_unknown",
      "message": "is unknown",
      "longMessage": "first_name is not a valid parameter for this request.",
      "meta": {
        "paramName": "first_name"
      }
    }
  ]
}

Is it a bug or I'm doing something wrong?

Used versions:

Upvotes: 0

Views: 1572

Answers (1)

ctdio
ctdio

Reputation: 126

You need to enable the Users can set their first and last name option to set those properties. This option is disabled by default. You can find that on the Email, Phone, Username page under the User & Authentication section.

enter image description here

From there, scroll down to the Personal Information section and make sure the checkbox is enabled.

enter image description here

Upvotes: 6

Related Questions