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.

Prisma Client returns incompatible BigInt type for fields

See original GitHub issue

Bug description

When we use JS BigInt feature from ES2020, TypeScript uses the lowercase bigint primitive type, just like number vs. Number:

image

However, Prisma Client returns BigInt interface, which is incompatible with that bigint type:

image

How to reproduce

Create a Prisma model with BigInt columns and use Prisma Client method like .findFirst() to get the data. Then try to assign to a property/variable of bigint primitive type.

Expected behavior

Prisma Client should return primitive bigint type, just like it do with string or number.

Prisma information

model reveal {
  operation_id      BigInt          @id
  fee               BigInt
}

Environment & setup

  • OS: Ubuntu 20.04
  • Database: PostgreSQL
  • Node.js version: 15.8
  • Prisma version:
prisma               : 2.17.0
@prisma/client       : 2.17.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio               : 0.353.0
Preview Features     : orderByRelation

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
rode093commented, Jul 18, 2022

Facing same trouble with latest version of prisma. Older version is working good

1reaction
timsuchanekcommented, Feb 25, 2021

Thanks a lot for reporting 🙏 This issue is fixed in the latest dev version of @prisma/client. You can try it out with npm i @prisma/client@dev.

In case it’s not fixed for you - please let us know and we’ll reopen this issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma schema API (Reference)
API reference documentation for the Prisma Schema Language (PSL). ... is enforced by foreign keys in the database or emulated in the Prisma...
Read more >
Working with fields (Concepts) - Prisma
BigInt fields are represented by the BigInt type (Node.js 10.4.0+ required). The following example demonstrates how to use the BigInt type:.
Read more >
Error message reference - Prisma
Prisma Client throws a PrismaClientUnknownRequestError exception if the query engine returns an error related to a request that does not have an error...
Read more >
Upgrade to Prisma 4
Prisma 4 introduces a number of breaking changes when you upgrade from an earlier Prisma version. This guide explains how this upgrade might...
Read more >
PostgreSQL database connector (Reference) - Prisma
This page explains how Prisma can connect to a PostgreSQL database using the ... native database types that are not yet supported as...
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