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.

`nativeTypes` Preview Feature not Recognized in Generator Block

See original GitHub issue

Bug description

When trying to use a native database type, an error indicates that the nativeTypes feature must first be enabled in the Datasource block:

image

However, at runtime or when migrating, seeding and etc., an error suggests that previewFeatures should only be placed in the generator block:

image

Entering the nativeTypes feature in the expected generator block does not validate any native type fields, like @db.Uuid.

How to reproduce

  1. First, try generating the client with the schema as is with. prisma generate. You’ll get the error mentioned above.
  2. Move the previewFeatures = ["nativeTypes"] line to the datasource block, you’ll notice no error is shown for the native type @db.Uuid but will throw an error once you try to do prisma generate.

Expected behavior

It should run and recognize any or all native data types without throwing errors

Prisma information

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

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

model User {
  id    String     @id @db.Uuid @default(dbgenerated("uuid_generate_v4()"))
  email String  @unique
  name  String?
}

Environment & setup

  • OS: MacOS
  • Database: PostGreSQL
  • Node.js version: v14.15.3

Prisma Version

- Prisma: v2.23.0
- Prisma Client: v2.23.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Karl-EdwardFPJeanMehucommented, Jun 2, 2021

Ok, So I reinstalled VS Code and it seems to be working fine now. I assume it was an outdated Prisma plugin installed via Settings Sync from an other computer.

0reactions
pantharshit00commented, Jun 3, 2021

Thanks for the info @Karl-EdwardFPJeanMehu

I am going to close this. I can’t reproduce this from the CLI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma generate or introspect don't work when nativeTypes ...
When you have in your prisma schema enabled nativeTypes preview feature, running prisma generate or prisma introspect throws error:.
Read more >
Prisma schema API (Reference)
previewFeatures, No, List of Enums, Use intellisense to see list of currently available Preview features ( Ctrl+Space in Visual Studio Code) Default: none....
Read more >
Prisma & PlanetScale Best Practices - YouTube
So the preview feature flag `referentialIntegrity` will no longer be necessary in the ` generator client` block of the Prisma Schema.
Read more >
C/C++ Project Properties (Visual Studio) - Microsoft Learn
Reference guide to the Visual Studio Microsoft C/C++ project Property Pages properties.
Read more >
CodeSmith Generator Release Notes - Spaces - Confluence
Fixed breaking issue where non blocked if statements wouldn't be rendered ... Fixed a bug where the View Visible Whitespace feature wasn't working...
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