Skip to content

Updating user_metadata from GoTrueAdminApi does not trigger the listener onAuthStateChange #2103

@juanantoniosantanamedina

Description

Describe the bug

After receiving a web hook from an external system, I'm trying to modify a flag stored in the user_metadata. As it is server side I only have the user id so I'm using supabase.auth.admin.updateUserById to update the data. I was hoping that it would trigger the listener onAuthStateChange with a userUpdate event, pretty much as the updateUser in the GoTrueClient does, but it does not trigger the listener.

The web hook executes an edge function.

Is that the expected behaviour?

Thanks in advance
Juan

Library affected

supabase-js

Reproduction

No response

Steps to reproduce

No response

System Info

System:
    OS: macOS 26.2
    CPU: (16) arm64 Apple M3 Max
    Memory: 4.33 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.20.0 - /usr/local/bin/node
    npm: 11.6.2 - /usr/local/bin/npm
    Deno: 2.3.1 - /Users/juanantoniosantana/.deno/bin/deno
  Browsers:
    Chrome: 144.0.7559.133
    Firefox: 91.7.1
    Safari: 26.2
    Safari Technology Preview: 26.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsupabase-jsRelated to the supabase-js library.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions