Internal Server Error when creating a new base
Describe the bug I'm getting a 500 Internal Server Error when creating a new base on a teable instance deployed in Fly.io.
I'm using Fly's unmanaged Postgres instance, it let me open the UI, add a new admin user and all, but when creating a new base I'm getting an Internal Server Error:
{"message":"Internal Server Error","status":500,"code":"internal_server_error"}
And in the app logs:
{"level":50,"time":1740305699153,"pid":644,"hostname":"e825104f713148","name":"teable","req":{"id":"7a7853a3a3ba257ae93728614da7920e","method":"POST","url":"/api/base","query":{},"params":{"0":"api/base"},"remoteAddress":"::ffff:172.16.33.26","remotePort":60122},"context":"GlobalExceptionFilter","url":"/api/base","message":"Cannot read properties of undefined (reading 'createSchema')","spanId":"cf198d3a64e48d42","traceId":"7a7853a3a3ba257ae93728614da7920e","msg":"TypeError: Cannot read properties of undefined (reading 'createSchema')\n at /app/apps/nestjs-backend/dist/index.js:34679:45\n at async Proxy._transactionWithCallback (/app/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/runtime/library.js:130:7984)\n at async BaseController.createBase (/app/apps/nestjs-backend/dist/index.js:34170:16)"}
{"level":30,"time":1740305699158,"pid":644,"hostname":"e825104f713148","name":"teable","req":{"id":"7a7853a3a3ba257ae93728614da7920e","method":"POST","url":"/api/base","query":{},"params":{"0":"api/base"},"remoteAddress":"::ffff:172.16.33.26","remotePort":60122},"res":{"statusCode":500},"err":{"type":"Error","message":"failed with status code 500","stack":"Error: failed with status code 500\n at onResFinished (/app/node_modules/.pnpm/[email protected]/node_modules/pino-http/logger.js:114:39)\n at ServerResponse.onResponseComplete (/app/node_modules/.pnpm/[email protected]/node_modules/pino-http/logger.js:177:14)\n at /app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:55\n at AsyncLocalStorage.run (node:async_hooks:335:14)\n at AsyncLocalStorageContextManager.with (/app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)\n at ServerResponse.contextWrapper (/app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:32)\n at ServerResponse.emit (node:events:526:35)\n at ServerResponse.emit (node:domain:488:12)\n at onFinish (node:_http_outgoing:1005:10)\n at callback (node:internal/streams/writable:608:21)"},"responseTime":20,"spanId":"cf198d3a64e48d42","traceId":"7a7853a3a3ba257ae93728614da7920e","msg":"request errored"}
To Reproduce Steps to reproduce the behavior:
- Custom Dockerfile "merging" both the main & migrate images
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
FROM ghcr.io/teableio/teable:latest
ARG PRISMA_VERSION=5.11.0
RUN set -eux; \
npm install zx @httpx/dsn-parser \
@prisma/client@${PRISMA_VERSION} \
prisma@${PRISMA_VERSION} -g; \
apt-get update; \
apt-get install -y --no-install-recommends \
openssl \
netcat-traditional \
wget \
; \
rm -rf /var/lib/apt/lists/*; \
ln -s /usr/local/lib/node_modules node_modules
WORKDIR /prisma
COPY --link packages/db-main-prisma/prisma/postgres ./postgres_migrate
RUN cd postgres_migrate && prisma generate
COPY --link packages/db-main-prisma/prisma/sqlite ./sqlite_migrate
RUN cd sqlite_migrate && prisma generate
WORKDIR /app
COPY --chown=nodejs:nodejs scripts/migrate.sh ./scripts/migrate.sh
RUN chmod +x ./scripts/migrate.sh
COPY --chown=nodejs:nodejs scripts/start.sh ./scripts/start.sh
- Deploy in Fly.io with the Postgres Unmanaged DB addon
- Set up env vars for this Postgres deployment
- Custom start.sh & migrate.sh script for the release command.
start.sh:
#!/bin/bash
if [ -z "$RELEASE_COMMAND" ]; then
node ./apps/nestjs-backend/dist/index.js &
node ./plugins/server.js &
wait -n
fi
# Run passed command
exec "$@"
migrate.sh
#!/bin/bash
cd /prisma/postgres_migrate
prisma migrate deploy
The release seems to go as it should, and definitely the schemas are being created since I'm able to create an user and navigate through the UI.
Additionally, the admin setting to disable sign ups is not working either (might be related, IDK)
Expected behavior Being able to create a base.
Platform (Please tell us which deployment version you are using) fly-io
I have same error, when I use PRISMA_DATABASE_URL=postgres://.... After change it to PRISMA_DATABASE_URL=postgresql:// error is gone.
Facing a similar issue myself since updating to the latest version yesterday.
Clicking on an existing base (or creating a new base) results in an error page. Accessing a particular table's url (domain.com/base/baseid/tableid) works just fine.
When faced with the error upon base creation, the base is still created (even though an error page is displayed)
EDIT: I think my issue is quite different from this one actually, please ignore this. I'll create a new issue.
Now that the migration is integrated into the teable image, there is no need for a separate db-migrate image. Please confirm whether the problem still exists.