#/admin/api/v1/workers requires admin user

1 messages · Page 1 of 1 (latest)

agile gazelle
#

I'm attempting to follow the instructions at https://github.com/triggerdotdev/trigger.dev/tree/main/apps/supervisor to create worker groups for each of my trigger supervisors to connect. I am getting an error but it is unclear how I can make my user an admin. It was the first user that logged into the system. Any help is greatly appreciated.

{
"error": "You must be an admin to perform this action"
}

api_url=http://localhost:3030
wg_name=my-worker

edit this

admin_pat=tr_pat_...

curl -sS
-X POST
"$api_url/admin/api/v1/workers"
-H "Authorization: Bearer $admin_pat"
-H "Content-Type: application/json"
-d "{"name": "$wg_name"}"

GitHub

Trigger.dev – build and deploy fully‑managed AI agents and workflows - triggerdotdev/trigger.dev

rare condorBOT
#

Hi @agile gazelle. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I’m sorry, but the provided knowledge sources don’t describe how /admin/api/v1/workers auth works or how to make a user an “admin” in a self‑hosted instance, so I can’t give a definitive, step‑by‑step fix.

Here’s what is documented and may help you move forward:

  1. Admin users via ADMIN_EMAILS (webapp env var)
    The self‑hosting env docs mention an ADMIN_EMAILS environment variable on the webapp:

    ADMIN_EMAILS – Regex of user emails to automatically promote to admin. [Webapp env]

    On a self‑hosted instance, you can:

    • Set ADMIN_EMAILS so it matches your login email (e.g. ^[email protected]$ or a broader regex).
    • Restart the webapp so the setting takes effect.
    • Log out and log back in with that email so it’s picked up as admin.

    This is the only explicit mechanism in the docs that relates to “admin” status.

  2. PAT vs secret keys and scopes
    The docs explain that a Personal Access Token (tr_pat_…) is tied to a user and gives access to all orgs/projects that user can access, but they don’t say anything about it automatically granting admin privileges or being sufficient for /admin/api/v1/workers. [Management auth]

    So even with a valid PAT, if your user isn’t recognized as admin, the /admin/api/v1/workers endpoint can still reject you.

#
  1. No explicit docs for /admin/api/v1/workers
    The management API docs only cover the runs, task, envvars, and schedules endpoints and don’t mention /admin/api/v1/workers at all, nor how to call it or which auth it expects. [Management overview; Management auth]
    Because of that, I can’t confirm whether you’re supposed to use a PAT, a special admin token, or something else for that specific endpoint.

Given these limitations, the only concrete, doc‑backed action you can take is:

  • Configure ADMIN_EMAILS on your webapp so your email becomes an admin, then recreate your PAT and retry the call.

If that still fails, the docs don’t provide further detail. In that case, the recommended next step is to reach out directly to the Trigger.dev team (Discord, GitHub issue, or a call) so they can clarify the intended way to use /admin/api/v1/workers in self‑hosting. [Getting help]

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@agile gazelle Kapa.ai is still learning and improving, please let me know how I did by reacting below.

thick spoke
#

For an existing user account, you'll need to go edit the appropriate row in the user table and set admin to true manually

agile gazelle
#

OK I set the ADMIN_EMAILS and now I'm not getting that error but instead a 500 Internal Server Error. Are there any restrictions in the naming of a region? I'm trying my-region-01.

#

let me make sure my user is actually set as an admin and try again.

#

what does "No number after minus sign in JSON at position 1 mean?

#

I updated the Admin field in the table for my user and restarted the webapp. Then I got that error

#

I even tried completely deleting my user and recreating it after I had set the ADMIN_EMAILS and it still has that error.

#

my appologies it was postman causing the error

#

it works now

agile gazelle
#

Is there any way to delete a region? I was testing my deployment and it mostly succeeded but in order to test again I need to delete the regions that were created.

thick spoke
#

You'd have to edit it out of the DB, which I would use caution doing

#

I don't remember all of which tables tie to that

#

Especially because there's a flag that gets set somewhere for the global default worker group

agile gazelle
#

After the automation is fully tested I'll wipe the environment and build it from scratch with proper sizing so I'm ok I think. It seems to have done the trick