typebot.io
typebot.io copied to clipboard
TypeError: fetch failed with Gitlab
Hi ! I'm using the latest Typebot version with Gitlab as auth. I'm getting this issue when I'm logged in
[next-auth][error][CLIENT_FETCH_ERROR]
https://next-auth.js.org/errors#client_fetch_error fetch failed {
error: {
message: 'fetch failed',
stack: 'TypeError: fetch failed\n' +
' at Object.processResponse (node:internal/deps/undici/undici:6277:34)\n' +
' at node:internal/deps/undici/undici:6602:42\n' +
' at node:internal/process/task_queues:140:7\n' +
' at AsyncResource.runInAsyncScope (node:async_hooks:203:9)\n' +
' at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
name: 'TypeError'
},
url: 'https://editor.bot.asso.ilearned.eu/api/auth/session',
message: 'fetch failed'
}
And it just keeps loading
Here is my env file :
version: '3.9'
services:
typebot-db:
image: postgres:13
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=typebot
- POSTGRES_PASSWORD=XXXXX
typebot-builder:
image: baptistearno/typebot-builder:latest
restart: always
depends_on:
- typebot-db
ports:
- '8080:3000'
extra_hosts:
- 'host.docker.internal:host-gateway'
environment:
- DATABASE_URL=postgresql://postgres:XXXXX@typebot-db:5432/typebot
- NEXTAUTH_URL=https://editor.bot.asso.ilearned.eu
- NEXT_PUBLIC_VIEWER_URL=https://bot.asso.ilearned.eu
- ENCRYPTION_SECRET=XXXX
- GITLAB_CLIENT_ID=XXXX
- GITLAB_CLIENT_SECRET=XXXX
- GITLAB_BASE_URL=https://gitlab.ilearned.eu
- GITLAB_NAME=I Learned Gitlab
typebot-viewer:
image: baptistearno/typebot-viewer:latest
restart: always
ports:
- '8081:3000'
# See https://docs.typebot.io/self-hosting/configuration for more configuration options
environment:
- DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
- NEXT_PUBLIC_VIEWER_URL=https://bot.asso.ilearned.eu
- ENCRYPTION_SECRET=XXXX
volumes:
db_data:
I also tried with mail-based auth and I'm still getting this 401 error code on /api/workspaces
Ok so my guess is that typebot-builder
container doesn't have access to internet. So the call to 'https://editor.bot.asso.ilearned.eu/api/auth/session' just fails.
You could fix the fact that the container doesn't have access to internet (for a reason I don't know)
or
You can try to set a NEXTAUTH_URL_INTERNAL
to http://localhost:3000
Let me know!
I set this internal url en var, and it works 🥳 Thanks ! :D
I'll probably set it in the docker examples to avoid this kind of issue. Thank you for reporting this 👍
Hi @baptisteArno,
I wanted to deploy typebot on vercel with supabase attched. I have set all the variables of builder as mentioned in image according to documentation.
But still 401 error on api/workspaces
"message : not authenticated".
Also set the NEXTAUTH_URL_INTERNAL
to http://localhost:3000
but still not working.
Note : the api/workspaces
is hitting the server as GET
Request but I have searched in typebot's repo this api is implemented as PATCH, POST and DELETE
request seems weird to me.
You should not set NEXTAUTH_URL_INTERNAL
in a Vercel environment! Can you fill another issue if you have a bug if it's still happening?