# updateMe returns "invalid user credentials" in production but not locally

**URL:** <https://community.directus.com/t/updateme-returns-invalid-user-credentials-in-production-but-not-locally/841>\
**Category:** Help\
**Created:** [July 26, 2025, 8:22am UTC](https://community.directus.com/t/updateme-returns-invalid-user-credentials-in-production-but-not-locally/841 "2025-07-26T08:22:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefano\_Imparato](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/stefano_imparato/32/237_2.png) [@Stefano\_Imparato](https://community.directus.com/u/Stefano_Imparato)\
**Post date:** [July 26, 2025, 8:22am UTC](https://community.directus.com/t/updateme-returns-invalid-user-credentials-in-production-but-not-locally/841/1 "2025-07-26T08:22:55Z")

</div>

Hi, I’m trying to update the user first name and last name via a Server Action in NextJS deployed on vercel.

This happens after a user authenticated and received both a session and a refresh token

Locally I have no issue doing that, it’s working nicely. While deployed on production, this code:

```auto
    const me = await directus.request(updateMe({ first_name: data.firstName, last_name: data.lastName }));

```

fails with the error

```auto
{
  errors: [{ message: 'Invalid user credentials.', extensions: [Object] } ],
  response: Response {
    status: 401,
    statusText: 'Unauthorized',
    headers: Headers {
      date: 'Fri, 25 Jul 2025 15:43:09 GMT',
      'content-type': 'application/json; charset=utf-8',
      'content-length': '96',
      connection: 'keep-alive',
      server: 'cloudflare',
...

```

I’m refreshing the token just right before the request. My client is setup like this

```auto
const client = createDirectus(process.env.NEXT_PUBLIC_BASE_URL as string)
  .with(authentication('json', { credentials: 'include', autoRefresh: false }))
  .with(rest({ credentials: 'include' }))
  .with(graphql({ credentials: 'include' }));

```

logging `await directus.getToken()` locally returns the token, on Vercel Server Action returns `null`.

any ideas?
