Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Creating Personal Access Tokens on selfhosted site creates undefined error #1465

Open
Yoda-Soda opened this issue Nov 10, 2024 · 6 comments

Comments

@Yoda-Soda
Copy link

Yoda-Soda commented Nov 10, 2024

Provide environment information

System:
OS: Linux 6.8 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (4) x64 Intel(R) N100
Memory: 11.64 GB / 15.37 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 20.11.1 - /usr/local/bin/node
npm: 10.2.4 - /usr/local/bin/npm
pnpm: 8.15.5 - /usr/local/bin/pnpm

Describe the bug

After creating a Personal Access Tokens and adding the name (any string) I then trigger the following error:
image

Reproduction repo

not applicable

To reproduce

  1. I am running this on a coolify project using the following docker compose:
# documentation: https://trigger.dev
# slogan: The open source Background Jobs framework for TypeScript
# tags: trigger.dev, background jobs, typescript, trigger, jobs, cron, scheduler
# logo: svgs/trigger.png
# port: 3000
x-common-env: &common-env
  PORT: 3030
  REMIX_APP_PORT: 3000
  NODE_ENV: production
  RUNTIME_PLATFORM: docker-compose
  V3_ENABLED: true
  INTERNAL_OTEL_TRACE_DISABLED: 1
  INTERNAL_OTEL_TRACE_LOGGING_ENABLED: 0
  POSTGRES_USER: $SERVICE_USER_POSTGRES
  POSTGRES_PASSWORD: $SERVICE_PASSWORD_POSTGRES
  POSTGRES_DB: ${POSTGRES_DB:-trigger}
  MAGIC_LINK_SECRET: $SERVICE_PASSWORD_64_MAGIC
  SESSION_SECRET: $SERVICE_PASSWORD_64_SESSION
  ENCRYPTION_KEY: $SERVICE_PASSWORD_64_ENCRYPTION
  PROVIDER_SECRET: $SERVICE_PASSWORD_64_PROVIDER
  COORDINATOR_SECRET: $SERVICE_PASSWORD_64_COORDINATOR
  DATABASE_HOST: postgresql:5432
  DATABASE_URL: postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB?sslmode=disable
  DIRECT_URL: postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB?sslmode=disable
  REDIS_HOST: redis
  REDIS_PORT: 6379
  REDIS_TLS_DISABLED: true
  COORDINATOR_HOST: 127.0.0.1
  COORDINATOR_PORT: 9020
  WHITELISTED_EMAILS: ""
  ADMIN_EMAILS: ""
  DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT: 300
  DEFAULT_ENV_EXECUTION_CONCURRENCY_LIMIT: 100
  DEPLOY_REGISTRY_HOST: docker.io
  DEPLOY_REGISTRY_NAMESPACE: trigger
  REGISTRY_HOST: ${DEPLOY_REGISTRY_HOST}
  REGISTRY_NAMESPACE: ${DEPLOY_REGISTRY_NAMESPACE}
  AUTH_GITHUB_CLIENT_ID: ${AUTH_GITHUB_CLIENT_ID}
  AUTH_GITHUB_CLIENT_SECRET: ${AUTH_GITHUB_CLIENT_SECRET}
  RESEND_API_KEY: ${RESEND_API_KEY}
  FROM_EMAIL: ${FROM_EMAIL}
  REPLY_TO_EMAIL: ${REPLY_TO_EMAIL}
  LOGIN_ORIGIN: $SERVICE_FQDN_TRIGGER_3000
  APP_ORIGIN: $SERVICE_FQDN_TRIGGER_3000
  DEV_OTEL_EXPORTER_OTLP_ENDPOINT: $SERVICE_FQDN_TRIGGER_3000/otel
  OTEL_EXPORTER_OTLP_ENDPOINT: "http://trigger:3040/otel"
  ELECTRIC_ORIGIN: http://electric:3000
services:
  trigger:
    image: ghcr.io/triggerdotdev/trigger.dev:v3
    environment:
      SERVICE_FQDN_TRIGGER_3000: ""
      <<: *common-env
    depends_on:
      postgresql:
        condition: service_healthy
      redis:
        condition: service_healthy
      electric:
        condition: service_healthy
    healthcheck:
      test: "timeout 10s bash -c ':> /dev/tcp/127.0.0.1/3000' || exit 1"
      interval: 10s
      timeout: 5s
      retries: 5
  electric:
    image: electricsql/electric
    environment:
      <<: *common-env
    depends_on:
      postgresql:
        condition: service_healthy
    healthcheck:
      test:
        - CMD-SHELL
        - pwd
  redis:
    image: "redis:7"
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    healthcheck:
      test:
        - CMD-SHELL
        - "redis-cli -h localhost -p 6379 ping"
      interval: 5s
      timeout: 5s
      retries: 3
    volumes:
      - redis-data:/data
  postgresql:
    image: postgres:16-alpine
    volumes:
      - postgresql-data:/var/lib/postgresql/data
    environment:
      <<: *common-env
    command:
      - -c
      - wal_level=logical
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 20s
      retries: 10
  docker-provider:
    image: ghcr.io/triggerdotdev/provider/docker:v3
    platform: linux/amd64
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    user: root
    depends_on:
      trigger:
        condition: service_healthy
    environment:
      <<: *common-env
      PLATFORM_HOST: trigger
      PLATFORM_WS_PORT: 3030
      SECURE_CONNECTION: "false"
      PLATFORM_SECRET: $PROVIDER_SECRET
  coordinator:
    image: ghcr.io/triggerdotdev/coordinator:v3
    platform: linux/amd64
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    user: root
    depends_on:
      trigger:
        condition: service_healthy
    environment:
      <<: *common-env
      PLATFORM_HOST: trigger
      PLATFORM_WS_PORT: 3030
      SECURE_CONNECTION: "false"
      PLATFORM_SECRET: $COORDINATOR_SECRET
    healthcheck:
      test:
        - CMD-SHELL
        - pwd
  1. Create a new access token
  2. Error will then trigger

Additional information

Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'private-state-token-redemption'.
Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'private-state-token-issuance'.
Error with Permissions-Policy header: Unrecognized feature: 'browsing-topics'.
tokens:24

   GET https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015 net::ERR_BLOCKED_BY_CLIENT

root-JWRAFXBJ.js:9

   POST https://trigger.claasen.cc/account/tokens?_data=routes%2Faccount.tokens 400 (Bad Request)

window._fetchProxy @ root-JWRAFXBJ.js:9
window._highlightFetchPatch @ root-JWRAFXBJ.js:9
Fr @ chunk-JBSYHZX3.js:18
await in Fr
da @ chunk-JBSYHZX3.js:24
action @ chunk-JBSYHZX3.js:24
m @ chunk-JBSYHZX3.js:2
ot @ chunk-JBSYHZX3.js:2
wa @ chunk-JBSYHZX3.js:1
Ea @ chunk-JBSYHZX3.js:1
(anonymous) @ chunk-JBSYHZX3.js:2
w.createElement.ce.onSubmit @ chunk-JBSYHZX3.js:2
oc @ chunk-LYHQCUWL.js:5
ac @ chunk-LYHQCUWL.js:5
cc @ chunk-LYHQCUWL.js:5
po @ chunk-LYHQCUWL.js:5
As @ chunk-LYHQCUWL.js:5
(anonymous) @ chunk-LYHQCUWL.js:5
ku @ chunk-LYHQCUWL.js:8
cs @ chunk-LYHQCUWL.js:5
Fl @ chunk-LYHQCUWL.js:5
Xi @ chunk-LYHQCUWL.js:5
Nc @ chunk-LYHQCUWL.js:5
chunk-LYHQCUWL.js:8 TypeError: Cannot read properties of undefined (reading 'split')
at L (chunk-4QLYPARN.js:1:2114)
at chunk-GVVQJ7TX.js:1:1694
at Object.pa [as useMemo] (chunk-LYHQCUWL.js:6:23795)
at r.useMemo (chunk-FTYKMG53.js:1:6137)
at oe (chunk-GVVQJ7TX.js:1:1644)
at re (account.tokens-CBMHX44X.js:1:4940)
at du (chunk-LYHQCUWL.js:6:19466)
at _i (chunk-LYHQCUWL.js:8:3133)
at Ba (chunk-LYHQCUWL.js:8:44432)
at Ua (chunk-LYHQCUWL.js:8:39459)
overrideMethod @ hook.js:608
xi @ chunk-LYHQCUWL.js:8
i.componentDidCatch.t.callback @ chunk-LYHQCUWL.js:8
Co @ chunk-LYHQCUWL.js:6
Ao @ chunk-LYHQCUWL.js:8
Ra @ chunk-LYHQCUWL.js:8
If @ chunk-LYHQCUWL.js:8
Bf @ chunk-LYHQCUWL.js:8
hn @ chunk-LYHQCUWL.js:8
Fa @ chunk-LYHQCUWL.js:8
Sl @ chunk-LYHQCUWL.js:1
hl @ chunk-LYHQCUWL.js:1
Show 1 more frame
Show less
chunk-JBSYHZX3.js:2 React Router caught the following error during render TypeError: Cannot read properties of undefined (reading 'split')
at L (chunk-4QLYPARN.js:1:2114)
at chunk-GVVQJ7TX.js:1:1694
at Object.pa [as useMemo] (chunk-LYHQCUWL.js:6:23795)
at r.useMemo (chunk-FTYKMG53.js:1:6137)
at oe (chunk-GVVQJ7TX.js:1:1644)
at re (account.tokens-CBMHX44X.js:1:4940)
at du (chunk-LYHQCUWL.js:6:19466)
at _i (chunk-LYHQCUWL.js:8:3133)
at Ba (chunk-LYHQCUWL.js:8:44432)
at Ua (chunk-LYHQCUWL.js:8:39459) {componentStack: '\n at re (https://trigger.claasen.cc/build/route…claasen.cc/build/_shared/chunk-DGKAL6G7.js:1:186)'}componentStack: "\n at re (https://trigger.claasen.cc/build/routes/account.tokens-CBMHX44X.js:1:4909)\n at div\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:3847\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:4583\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:3130\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:2725\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:3847\n at https://trigger.claasen.cc/build/_shared/chunk-Y6JHH73C.js:1:384\n at https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:3527\n at https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:2339\n at Ce (https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:7705)\n at https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:2087\n at div\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:3130\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:2725\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:3847\n at https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:7410\n at Ce (https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:7705)\n at u (https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:996)\n at se (https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:1327)\n at ee (https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:4672)\n at https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:5173\n at u (https://trigger.claasen.cc/build/_shared/chunk-HLDNCM5C.js:1:996)\n at ne (https://trigger.claasen.cc/build/_shared/chunk-XJK4FH5I.js:1:601)\n at div\n at j (https://trigger.claasen.cc/build/_shared/chunk-WZVPZJ3P.js:1:1895)\n at div\n at div\n at div\n at G (https://trigger.claasen.cc/build/_shared/chunk-WZVPZJ3P.js:1:1047)\n at div\n at fo (https://trigger.claasen.cc/build/_shared/chunk-ALXCXKJV.js:1:3658)\n at X (https://trigger.claasen.cc/build/routes/account.tokens-CBMHX44X.js:1:3588)\n at So (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:18639)\n at _n (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:21220)\n at div\n at yt (https://trigger.claasen.cc/build/_shared/chunk-ALXCXKJV.js:1:3548)\n at div\n at div\n at vo (https://trigger.claasen.cc/build/_shared/chunk-ALXCXKJV.js:1:3424)\n at L\n at So (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:18639)\n at _n (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:21220)\n at body\n at html\n at rs (https://trigger.claasen.cc/build/root-JWRAFXBJ.js:14:109345)\n at So (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:18639)\n at dr (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:22722)\n at Qo (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:30169)\n at gr (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:21257)\n at Mn (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:2:28244)\n at $t (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:14:2378)\n at Ui (https://trigger.claasen.cc/build/_shared/chunk-JBSYHZX3.js:24:2690)\n at x (https://trigger.claasen.cc/build/_shared/chunk-XEZL6SGQ.js:1:185)\n at y (https://trigger.claasen.cc/build/_shared/chunk-DGKAL6G7.js:1:186)"[[Prototype]]: Object
overrideMethod @ hook.js:608
componentDidCatch @ chunk-JBSYHZX3.js:2
i.componentDidCatch.t.callback @ chunk-LYHQCUWL.js:8
Co @ chunk-LYHQCUWL.js:6
Ao @ chunk-LYHQCUWL.js:8
Ra @ chunk-LYHQCUWL.js:8
If @ chunk-LYHQCUWL.js:8
Bf @ chunk-LYHQCUWL.js:8
hn @ chunk-LYHQCUWL.js:8
Fa @ chunk-LYHQCUWL.js:8
Sl @ chunk-LYHQCUWL.js:1
hl @ chunk-LYHQCUWL.js:1
Show 1 more frame
Show less
Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'private-state-token-redemption'.
Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'private-state-token-issuance'.
Error with Permissions-Policy header: Unrecognized feature: 'browsing-topics'.
root-JWRAFXBJ.js:9

   POST https://trigger.claasen.cc/account/tokens?_data=routes%2Faccount.tokens 400 (Bad Request)

window._fetchProxy @ root-JWRAFXBJ.js:9
window._highlightFetchPatch @ root-JWRAFXBJ.js:9
Fr @ chunk-JBSYHZX3.js:18
await in Fr
da @ chunk-JBSYHZX3.js:24
action @ chunk-JBSYHZX3.js:24
m @ chunk-JBSYHZX3.js:2
ot @ chunk-JBSYHZX3.js:2
wa @ chunk-JBSYHZX3.js:1
Ea @ chunk-JBSYHZX3.js:1
(anonymous) @ chunk-JBSYHZX3.js:2
w.createElement.ce.onSubmit @ chunk-JBSYHZX3.js:2
oc @ chunk-LYHQCUWL.js:5
ac @ chunk-LYHQCUWL.js:5
cc @ chunk-LYHQCUWL.js:5
po @ chunk-LYHQCUWL.js:5
As @ chunk-LYHQCUWL.js:5
(anonymous) @ chunk-LYHQCUWL.js:5
ku @ chunk-LYHQCUWL.js:8
cs @ chunk-LYHQCUWL.js:5
Fl @ chunk-LYHQCUWL.js:5
Xi @ chunk-LYHQCUWL.js:5
Nc @ chunk-LYHQCUWL.js:5
Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'private-state-token-redemption'.
Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'private-state-token-issuance'.
Error with Permissions-Policy header: Unrecognized feature: 'browsing-topics'.

@Yoda-Soda
Copy link
Author

I am happy to share access if required.

@Yoda-Soda
Copy link
Author

Seems to also have an issue when trying to create a token via the CLI. I am guessing it's related.

@Cirr0e
Copy link

Cirr0e commented Nov 25, 2024

Hi there! I've analyzed your issue with Personal Access Token creation, and I think I can help resolve this.

The error you're experiencing appears to be related to known token handling issues that have been fixed in recent versions. Based on the error patterns and similar reported issues, here's what we need to do:

  1. First, let's verify and upgrade your Trigger.dev version:

    • The token-related issues have been fixed in versions 3.1.1 and 3.2.1
    • Update your docker-compose configuration to use the latest v3 image:
    image: ghcr.io/triggerdotdev/trigger.dev:latest-v3
  2. Check your environment configuration:
    Make sure these environment variables are properly set:

    • SESSION_SECRET
    • ENCRYPTION_KEY
    • MAGIC_LINK_SECRET
      These are critical for token generation and authentication.
  3. After upgrading, clean up your existing state:

    docker-compose down
    docker volume prune  # Be careful with this if you have other important volumes
    docker-compose up -d
  4. When creating new tokens, ensure you're using the correct scope format:

    const publicToken = await auth.createPublicToken({
      scopes: {
        read: {
          runs: true
        }
      }
    });

If you're still experiencing issues after implementing these changes, please provide:

  • Your current Trigger.dev version
  • The specific CLI error message
  • Any error messages in the server logs

References:

Important Notes:

  • Backup your data before performing any upgrades
  • Existing tokens may need to be regenerated after the upgrade
  • Monitor the logs during the upgrade process for any migration errors

Let me know if you need any clarification or run into any issues during the upgrade process!

@Yoda-Soda
Copy link
Author

Thank you'll have a go at it.

@agonbina
Copy link

FYI ran into the same issue and it seems to be due to one of the environment variables that trigger needs. What I did:

  1. Regenerate keys
  2. Update all environment variables, restart containers

List of keys:

echo MAGIC_LINK_SECRET=$(openssl rand -hex 16)
echo SESSION_SECRET=$(openssl rand -hex 16)
echo ENCRYPTION_KEY=$(openssl rand -hex 16)
echo PROVIDER_SECRET=$(openssl rand -hex 32)
echo COORDINATOR_SECRET=$(openssl rand -hex 32)

@beejaz
Copy link

beejaz commented Dec 1, 2024

FYI ran into the same issue and it seems to be due to one of the environment variables that trigger needs. What I did:

  1. Regenerate keys
  2. Update all environment variables, restart containers

List of keys:

echo MAGIC_LINK_SECRET=$(openssl rand -hex 16)
echo SESSION_SECRET=$(openssl rand -hex 16)
echo ENCRYPTION_KEY=$(openssl rand -hex 16)
echo PROVIDER_SECRET=$(openssl rand -hex 32)
echo COORDINATOR_SECRET=$(openssl rand -hex 32)

Yes, this solves it for me also. This is a bug on Coolify side (template generation issue). It was said from Coolify team that it will be fixed soon.

Happy triggering!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants