question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tearing down MSSQL schema returns "Cannot read property 'split' of null"

See original GitHub issue

Bug description

Unable to migrate.

Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "ms"


Error: Cannot read property 'split' of null

How to reproduce

Currently Prisma schema from introspecting an MSSQL database:

generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["microsoftSqlServer", "nativeTypes"]
}

datasource ms {
  provider = "sqlserver"
  url      = env("DATABASE_URL")
}

model User {
  id   BigInt  @id @default(autoincrement()) @ms.BigInt
  name String? @ms.VarChar(255)
  Post Post[]
}

model Post {
  id        BigInt @id @default(autoincrement()) @ms.BigInt
  title     String @ms.VarChar(100)
  views     BigInt @default(0) @ms.BigInt
  wordCount Int    @default(0) @ms.SmallInt
  user_id   BigInt @ms.BigInt
  User      User   @relation(fields: [user_id], references: [id])
}

model Settings {
  id    Int    @id @default(autoincrement())
  title String
}

Since we don’t support native types yet, I adjusted it to this:

generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["microsoftSqlServer"]
}

datasource ms {
  provider = "sqlserver"
  url      = env("DATABASE_URL")
}

// model User {
//   id   BigInt  @id @default(autoincrement()) @ms.BigInt
//   name String? @ms.VarChar(255)
//   Post Post[]
// }

// model Post {
//   id        BigInt @id @default(autoincrement()) @ms.BigInt
//   title     String @ms.VarChar(100)
//   views     BigInt @default(0) @ms.BigInt
//   wordCount Int    @default(0) @ms.SmallInt
//   user_id   BigInt @ms.BigInt
//   User      User   @relation(fields: [user_id], references: [id])
// }

// model Settings {
//   id    Int    @id @default(autoincrement())
//   title String
// }

Then ran:

npx prisma migrate dev --preview-feature

Resulting in:

Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "ms"


Error: Cannot read property 'split' of null

Expected behavior

It should have cleared out my database.

Environment & setup

  • OS:
  • Database:
  • Node.js version:
  • Prisma version:
@prisma/cli          : 2.13.0-dev.99
@prisma/client       : 2.12.0-dev.55
Current platform     : darwin
Query Engine         : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio               : 0.329.0
Preview Features     : microsoftSqlServer

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
matthewmuellercommented, Dec 21, 2020

Just tested it again, also got

Error: "nativeTypes" preview feature is not supported yet. Remove it from your schema to use Prisma Migrate.

Looks like it was fixed, closing!

0reactions
Jolg42commented, Dec 14, 2020

The native type gating works too well 😄, I can’t reproduce

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read Property 'split' of Null in JS | bobbyhadz
The "Cannot read property 'split' of null" error occurs when the split() method is called on a variable that stores a null value....
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
TypeError: Cannot read properties of null (reading 'split')
I have an angular application which is throwing me this error when I try to access it. TypeError: Cannot read properties of null...
Read more >
cannot read properties of null (reading 'matches') npm - You.com
Cannot read property 'match' of undefined error handling ... The following function will return an array of the parameter names of any function...
Read more >
SQL error messages and exceptions - Oracle Help Center
08004, User ' <authorizationID> ' cannot shut down database ... 22501, An ESCAPE clause of NULL returns undefined results and is not allowed....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found