Commit Graph
8 Commits
Author SHA1 Message Date
Alaister Young f05ab582da chore(studio): wire self-hosted run + e2e env handling for TanStack build
Previous setup ran the studio under `vite preview` and signalled e2e
mode via `NODE_ENV=test`. That broke twice on this branch:

1. `NODE_ENV=test` in the shell overrides Vite's default
   `NODE_ENV=production` for `vite build`, which makes
   `@vitejs/plugin-react` emit the dev JSX runtime (`jsxDEV`). The
   production SSR bundle doesn't have `jsxDEV` available, so every SSR
   request crashed with `TypeError: jsxDEV is not a function`.
2. `vite preview` is a static SPA preview; it can't reuse the
   `fetch`-handler shape that `apps/studio/api/server.js` exposes to
   Vercel. Self-hosted prod needs its own HTTP listener for the same
   handler.

Changes:

- Swap `NODE_ENV=test` for `MODE=test` end-to-end. `vite build --mode
  test` keeps `NODE_ENV=production` automatically (per Vite docs), so
  the React plugin stays on the prod JSX runtime and TanStack Start
  bakes the right `NODE_ENV` into the SSR bundle. `.env.test` overrides
  load through the standard `loadEnv(mode, ...)` order, so the
  developer's `.env.local` no longer leaks `NEXT_PUBLIC_IS_PLATFORM=true`
  into e2e builds.
- Explicitly set `NEXT_PUBLIC_IS_PLATFORM=false` in
  `generateLocalEnv.js` so `.env.test` (which loads after `.env.local`)
  wins regardless of what a developer has set locally.
- Add `apps/studio/scripts/serve.js`: a small zero-dep Node HTTP
  adapter that loads env files, serves `dist/client/*` statics with
  proper cache headers, and forwards everything else to the
  `fetch`-handler exported by `dist/server/server.js` — the same
  handler `api/server.js` hands to Vercel. `pnpm start` runs this;
  `pnpm preview` keeps the old `vite preview` flow as a debug
  escape-hatch.
- Add `dist/**` to studio's turbo outputs so cached builds restore
  the Vite output (not just the legacy `.next/**`).
- Declare `MODE`, `PORT` in turbo env so cache invalidates correctly
  when switching between test and production builds.
2026-05-15 16:19:59 +08:00
1862b71745 feat(studio-local): functions management api - list functions (#40690)
## What is the current behaviour?

Functions page on self-hosted differs from Platform

## What is the new behaviour?

Adds the possibility to see a list of edge-functions in Self-Host
version.

## Summary by CodeRabbit

* **New Features**
* Added self-hosted edge functions support with filesystem-based
artifact listing and a new API endpoint to list local functions.
* Improved functions UI: unified view, enhanced search and adjacent sort
controls, and clearer local-hosting guidance.

* **Chores**
* Added environment configuration and docker volume for edge functions
management.
* Updated build/task config to pass through edge functions env and
include contentlayer outputs.

Co-authored-by: Ali Waseem <waseema393@gmail.com>
Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
2026-01-30 08:00:21 +08:00
Ivan Vasilov f3af2c3d3c feat: SQL Snippets (#41112)
* Use the .sql suffix when generating ids.

* Fix a bug where a new snippet would not show up in the snippet list until refresh.

* Add API routes which serve file snippets.

* Refactor the renameSnippet and moveSnippet to work with file snippets.

* Change the link to the SQL Editor.

* Minor fixes from CodeRabbit.

* Check the file/folder name for invalid chars.

* More fixes from CodeRabbit review.

* Fix minor issues.

* Use zod to parse the snippet ids when deleting.

* Try to fix snyk issue.

* Add validation to the GET content index route.

* Minor fixes.

* Show create a new folder, it was hidden by mistake.

* Add SNIPPETS_MANAGEMENT_FOLDER env var.

* Add snippets folder in the docker-compose.

* Add error toasts if the env var is not set.

* Add snippets management folder to the generateLocalEnv script.

* Revert the docker-compose changes, will be done in a followup PR.

* Revert also the snippets volume folder.

* Remove unneeded line.
2025-12-23 12:09:37 +01:00
Ali WaseemandCharis 7898abe06c Fix: Make self hosted tests more reliable locally and in CI (#40479)
* added ui studio command

* added SKIP ASSET UPLOAD option

* updated failing tests

* updated e2e scripts to include CI instructions

* removed unused envs and slack messages

* updated timeouts and max retries on CI

* updated generated local env

* updated env

* updated env generation for e2e tests

* remove vercel preview

* updated tests and trying junit report on PR

* update test comment

* updated commit hash for reporter

* updated file path

* updated runner to blacksmith

* update test file for reporting

* Update .github/workflows/studio-e2e-test.yml

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update package.json

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update e2e/studio/playwright.config.ts

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* updated to skip comment on forks

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-11-17 15:00:31 -07:00
ZiincandJordi Enric 5cfd10aae6 feat: self-hosted log drains (#28297)
* feat: initial log drain creation, sans rules creation.

* feat: add rules posting

* add project settings to self hosted and adapt log drains

* feat: log drains crud implementation, env var update

* feat: local log drains is working! rules provisioning refined

* fix: add filtering

* feat: finish implementing CRUD of local log drains.

* chore: formatting

* only allow navigation to log drains

* rm unnecessary checks

* rm log

* rm logs

* rm log

* fix type err

* turbofix for turboissue

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2025-10-30 10:37:32 +00:00
Han Qiao 6026a824a3 fix: update queries for local edge function and cron logs (#39388) 2025-10-13 15:20:23 +08:00
Matt Rossman 31b6368049 feat: read-only mode for self-hosted MCP (#39041)
* feat: add `crypto-js`, `encryptString` with sample key

* feat: include POSTGRES_PASSWORD in generated .env.test

* feat: include POSTGRES_PASSWORD in turbo.json for studio

* feat: read only query support

* feat: configurable `POSTGRES_HOST`, `POSTGRES_DB`, `POSTGRES_PORT`

* chore: rename POSTGRES_USER to clarify write permission

* feat: configurable `PG_META_CRYPTO_KEY`

* chore: add `PG_META_CRYPTO_KEY` to generateLocalEnv

* feat: add 'postgres-meta' to linter dictionary

* feat: restore read-only toggle in local MCP URL builder
2025-10-06 16:14:27 -04:00
Joshen Lim 66ad6153e0 Reinstate pnpm command for running studio in non hosted mode (#36309) 2025-06-10 23:45:41 +08:00