Skip to content

Prisma Studio fails on MSSQL database URLs #29620

Closed

Description

@serin113

Bug description

Starting Prisma Studio using an MSSQL connection URL in the format

sqlserver://host:1433;user={MyServer/User};password={Pass:Word;};database=db

as described in the Prisma docs fails with the error:

Loaded Prisma config from prisma.config.ts.


! The provided database URL is not valid.

The problem is due to all URLs being passed through URL.canParse(): https://github.com/prisma/prisma/blob/3937779e617c743966ebb50901d013167dd9171e/packages/cli/src/Studio.ts#L281-L283

That works for Postgres & MySQL connection URLs with these formats (all taken from different driver adapter pages in the docs):

postgresql://user:pass@host:5432/database
postgres://user:[email protected]:5432/db
postgresql://user:pass@host:5432/db?sslmode=require&sslcert=./cert.pem
mysql://user:pass@localhost/db?socket=/var/run/mysqld/mysqld.sock

but it doesn't work specifically with MSSQL URLs with this format (note the non-standard semicolons and braces):

sqlserver://HOST:PORT;database=DATABASE;user=USER;password=PASSWORD;encrypt=true
sqlserver://host:1433;user={MyServer/User};password={Pass:Word;};database=db

To quote the docs:

SQL Server uses JDBC-style connection strings:
sqlserver://HOST[:PORT];database=DATABASE;user=USER;password=PASSWORD;encrypt=true

Trying it out in the Node CLI:

> URL.canParse("postgresql://user:pass@host:5432/db?sslmode=require&sslcert=./cert.pem")
true
> URL.canParse("sqlserver://HOST:PORT;database=DATABASE;user=USER;password=PASSWORD;encrypt=true")
false

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

  1. Setup the following files for a basic Prisma project
    • .env with DATABASE_URL set to an MSSQL connection URL
    • schema.prisma
    • prisma.config.ts that uses the .env
  2. Run prisma studio

Expected vs. Actual Behavior

Expected behavior

The Prisma Studio server starts with a web URL.

Actual behvaior

Prisma Studio doesn't start.

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

It worked before the Studio rewrite in Prisma 7.0.0.

Workaround

Using a Prisma version < 7.0.0 and a pre-v7 schema with the MSSQL connection URL set in the datasource block works.

Prisma Schema & Queries

generator client {
  provider            = "prisma-client"
  previewFeatures     = ["nativeDistinct"]
  binaryTargets       = ["native"]
  output              = "./generated"
  importFileExtension = "js"
}

datasource db {
  provider = "sqlserver"
  schemas  = [..., ..., ...]
}

<misc. models>

Prisma Config

import { defineConfig } from "prisma/config";

export default defineConfig({
  schema: "schema.prisma",
  migrations: {
    path: "migrations",
    seed: "tsx seed.ts",
  },
  datasource: {
    url: process.env.DATABASE_URL!, // env is inserted using dotenvx
  },
});

Logs & Debug Info

<misc. corepack lines>

prisma:config:defineConfig [default]: '{\n  "loadedFromFile": null\n}' +270ms
prisma:config:defineConfig [config.schema]: 'schema.prisma' +1ms
prisma:config:defineConfig [config.datasource]: '{\n' +
  '  "url": "sqlserver://<host>:<port>;database=<database>;user=<user>;password=<password>;encrypt=<bool>;trustServerCertificate=<bool>"\n' +
  '}' +0ms
prisma:config:defineConfig [config.migrations]: '{\n  "path": "migrations",\n  "seed": "tsx seed.ts"\n}' +0ms
prisma:config:loadConfigFromFile Config file loaded in 25.86ms +0ms
prisma:config:PrismaConfig Parsing PrismaConfigInternal: '{\n' +
  '  "loadedFromFile": null,\n' +
  '  "schema": "schema.prisma",\n' +
  '  "datasource": {\n' +
  '    "url": "sqlserver://<host>:<port>;database=<database>;user=<user>;password=<password>;encrypt=<bool>;trustServerCertificate=<bool>"\n' +
  '  },\n' +
  '  "migrations": {\n' +
  '    "path": "migrations",\n' +
  '    "seed": "tsx seed.ts"\n' +
  '  }\n' +
  '}' +1ms
prisma:config:PrismaConfig Short-circuit: input is already a PrismaConfigInternal object +0ms
Loaded Prisma config from prisma.config.ts.

prisma:getSchema Reading schema from single file <path>/schema.prisma +366ms
prisma:getSchema Reading schema from single file <path>/schema.prisma +0ms
prisma:getConfig Using getConfig Wasm +0ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +8ms
prisma:cli:checkpoint runCheckpointClientCheck(): Execution time for getting info: 9.139040999999963 ms +0ms
prisma:cli:checkpoint runCheckpointClientCheck(): Execution time for "await checkpoint.check(data)": 5.104540999999983 ms +5ms
prisma:cli:bin Execution time for executing "await cli.parse(commandArray)": 14.743499999999983 ms +0ms


! The provided database URL is not valid.

Environment & Setup

  • OS: macOS
  • Database: MSSQL
  • Node.js version: v26.0.0

Prisma Version

prisma               : 7.8.0
@prisma/client       : Not found
Operating System     : darwin
Architecture         : arm64
Node.js              : v26.0.0
TypeScript           : unknown
Query Compiler       : enabled
PSL                  : @prisma/prisma-schema-wasm 7.8.0-6.3c6e192761c0362d496ed980de936e2f3cebcd3a
Schema Engine        : schema-engine-cli 3c6e192761c0362d496ed980de936e2f3cebcd3a (at <schema engine path>)
Default Engines Hash : 3c6e192761c0362d496ed980de936e2f3cebcd3a
Studio               : 0.27.3
Preview Features     : nativeDistinct

Activity

  1. added
    kind/bug
    on Jun 3, 2026
  2. changed the title [-]Prisma Studio >= v7.0.0 fails on MSSQL database URLs[/-] [+]Prisma Studio fails on MSSQL database URLs[/+] on Jun 3, 2026
  3. added a commit that references this issue on Jul 24, 2026
    28d393d
  4. added a commit that references this issue on Aug 9, 2026
    bfe0503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions